Do not warn for io.EOF when receiving ws msgs.
This commit is contained in:
parent
e7cf48aa26
commit
998a29b0e6
2 changed files with 12 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue