Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gostatsd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
gostatsd
Commits
8cf6ad33
Commit
8cf6ad33
authored
12 years ago
by
Kamil Kisiel
Browse files
Options
Downloads
Patches
Plain Diff
Documented console.go
parent
899d1553
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
statsd/console.go
+8
-0
8 additions, 0 deletions
statsd/console.go
with
8 additions
and
0 deletions
statsd/console.go
+
8
−
0
View file @
8cf6ad33
...
...
@@ -6,13 +6,17 @@ import (
"strings"
)
// DefaultConsoleAddr is the default address on which a ConsoleServer will listen
const
DefaultConsoleAddr
=
":8126"
// ConsoleServer is an object that listens for telnet connection on a TCP address Addr
// and provides a console interface to a manage a MetricsAggregator
type
ConsoleServer
struct
{
Addr
string
Aggregator
*
MetricAggregator
}
// ListenAndServe listens on the ConsoleServer's TCP network address and then calls Serve
func
(
s
*
ConsoleServer
)
ListenAndServe
()
error
{
addr
:=
s
.
Addr
if
addr
==
""
{
...
...
@@ -25,6 +29,8 @@ func (s *ConsoleServer) ListenAndServe() error {
return
s
.
Serve
(
l
)
}
// Serve accepts incoming connections on the listener and serves them a console interface to
// the MetricAggregator
func
(
s
*
ConsoleServer
)
Serve
(
l
net
.
Listener
)
error
{
defer
l
.
Close
()
for
{
...
...
@@ -38,11 +44,13 @@ func (s *ConsoleServer) Serve(l net.Listener) error {
panic
(
"not reached"
)
}
// consoleConn represents a single ConsoleServer connection
type
consoleConn
struct
{
conn
net
.
Conn
server
*
ConsoleServer
}
// serve reads from the consoleConn and responds to incoming requests
func
(
c
*
consoleConn
)
serve
()
{
defer
c
.
conn
.
Close
()
buf
:=
make
([]
byte
,
1024
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment