From 998a29b0e656676bc7e55f6d6676b42edb0c6811 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 17 Mar 2014 22:36:31 -0500 Subject: [PATCH] Do not warn for io.EOF when receiving ws msgs. --- rpcclient.go | 8 ++++++-- sockets.go | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rpcclient.go b/rpcclient.go index 986fab4..a00e743 100644 --- a/rpcclient.go +++ b/rpcclient.go @@ -28,6 +28,7 @@ import ( "github.com/conformal/btcutil" "github.com/conformal/btcwire" "github.com/conformal/btcws" + "io" ) // ServerConn is an interface representing a client connection to a bitcoin RPC @@ -225,8 +226,11 @@ func (btcd *BtcdRPCConn) Start() { for { var m string if err := websocket.Message.Receive(btcd.ws, &m); err != nil { - log.Infof("Cannot receive btcd websocket message: %v", - err) + // Log warning if btcd did not disconnect. + if err != io.EOF { + log.Infof("Cannot receive btcd websocket message: %v", + err) + } btcd.ws.Close() close(responses) return diff --git a/sockets.go b/sockets.go index ff219e2..e7bb547 100644 --- a/sockets.go +++ b/sockets.go @@ -31,6 +31,7 @@ import ( "github.com/conformal/btcwallet/wallet" "github.com/conformal/btcws" "github.com/conformal/go-socks" + "io" "io/ioutil" "net" "net/http" @@ -322,7 +323,11 @@ func WSSendRecv(ws *websocket.Conn) { for { var m []byte if err := websocket.Message.Receive(ws, &m); err != nil { - log.Infof("Cannot receive client websocket message: %v", err) + // Log warning if the client did not disconnect. + if err != io.EOF { + log.Warnf("Cannot receive client websocket message: %v", + err) + } close(received) return }