watchtower/wtserver/server: print connFailure error code name

This commit is contained in:
Conner Fromknecht 2019-04-23 20:06:38 -07:00
parent ec6e2010d6
commit 590f5811e8
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
4 changed files with 6 additions and 6 deletions

@ -142,6 +142,6 @@ func (s *Server) replyCreateSession(peer Peer, id *wtdb.SessionID,
// disconnect the client.
return &connFailure{
ID: *id,
Code: uint16(code),
Code: code,
}
}

@ -52,6 +52,6 @@ func (s *Server) replyDeleteSession(peer Peer, id *wtdb.SessionID,
// disconnect the client.
return &connFailure{
ID: *id,
Code: uint16(code),
Code: code,
}
}

@ -283,12 +283,12 @@ func (s *Server) handleClient(peer Peer) {
// error code.
type connFailure struct {
ID wtdb.SessionID
Code uint16
Code wtwire.ErrorCode
}
// Error displays the SessionID and Code that caused the connection failure.
func (f *connFailure) Error() string {
return fmt.Sprintf("connection with %s failed with code=%v",
return fmt.Sprintf("connection with %s failed with code=%s",
f.ID, f.Code,
)
}

@ -117,7 +117,7 @@ func (s *Server) handleStateUpdate(peer Peer, id *wtdb.SessionID,
if s.cfg.NoAckUpdates {
return &connFailure{
ID: *id,
Code: uint16(failCode),
Code: failCode,
}
}
@ -152,6 +152,6 @@ func (s *Server) replyStateUpdate(peer Peer, id *wtdb.SessionID,
// disconnect the client.
return &connFailure{
ID: *id,
Code: uint16(code),
Code: code,
}
}