Skip to content

Commit

Permalink
service: add pretty print
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Audebert committed Sep 4, 2014
1 parent 8ed1e30 commit 8fd8eaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cellaserv.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func handleSpy(conn net.Conn, req *cellaserv.Request) {

srvc, ok := services[data.Service][data.Identification]
if !ok {
log.Warning("[Cellaserv] Could not spy, no such service: %s/%s", data.Service,
log.Warning("[Cellaserv] Could not spy, no such service: %s %s", data.Service,
data.Identification)
sendReplyError(conn, req, cellaserv.Reply_Error_BadArguments)
return
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func handle(conn net.Conn) {
removeConnFromMap(subscriberMap)
removeConnFromMap(subscriberMatchMap)

// Remove spy info
// Remove conn from the services it spied
for _, srvc := range connSpies[conn] {
for i, connItem := range srvc.Spies {
if connItem == conn {
Expand Down
7 changes: 7 additions & 0 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ func newService(conn net.Conn, name string, ident string) *Service {
return s
}

func (s *Service) String() string {
if s.Identification != "" {
return s.Name + "/" + s.Identification
}
return s.Name
}

// JSONStruct creates a struc good for JSON encoding.
func (s *Service) JSONStruct() *ServiceJSON {
return &ServiceJSON{
Expand Down

0 comments on commit 8fd8eaf

Please sign in to comment.