Skip to content

Commit

Permalink
Add check for 'connection reset by peer' (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
altafan authored Feb 17, 2023
1 parent f7a2bed commit 19e7b4b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net"
"sync"
"sync/atomic"
"syscall"
"time"

"github.com/btcsuite/btcd/chaincfg/chainhash"
Expand Down Expand Up @@ -78,7 +79,8 @@ func (c *tcpClient) listen() {
var resp response
bytes, err := conn.ReadBytes(delim)
if err != nil {
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) {
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) ||
errors.Is(err, syscall.ECONNRESET) {
c.log("connection with server dropped, attempting to reconnect...")
c.reconnect()
return
Expand Down

0 comments on commit 19e7b4b

Please sign in to comment.