From 590f5811e80cd9769683717bc7262ec9ca079c19 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 23 Apr 2019 20:06:38 -0700 Subject: [PATCH] watchtower/wtserver/server: print connFailure error code name --- watchtower/wtserver/create_session.go | 2 +- watchtower/wtserver/delete_session.go | 2 +- watchtower/wtserver/server.go | 4 ++-- watchtower/wtserver/state_update.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/watchtower/wtserver/create_session.go b/watchtower/wtserver/create_session.go index 3217d601..3d5c9361 100644 --- a/watchtower/wtserver/create_session.go +++ b/watchtower/wtserver/create_session.go @@ -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, } } diff --git a/watchtower/wtserver/delete_session.go b/watchtower/wtserver/delete_session.go index a5b517c1..00b9b165 100644 --- a/watchtower/wtserver/delete_session.go +++ b/watchtower/wtserver/delete_session.go @@ -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, } } diff --git a/watchtower/wtserver/server.go b/watchtower/wtserver/server.go index 4a49c3ad..940b41cd 100644 --- a/watchtower/wtserver/server.go +++ b/watchtower/wtserver/server.go @@ -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, ) } diff --git a/watchtower/wtserver/state_update.go b/watchtower/wtserver/state_update.go index 7b3e0941..63a0a37d 100644 --- a/watchtower/wtserver/state_update.go +++ b/watchtower/wtserver/state_update.go @@ -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, } }