Skip to content

Commit

Permalink
fix(p2p): close receive on certain errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Aug 8, 2024
1 parent d5d7a94 commit 4a2b6c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gold/p2p/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,11 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
if config.ShowDebugLog {
logrus.Debugln("[tcp] recv from", ep, "err:", err)
}
_ = tcpconn.CloseRead()
return
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.ErrClosedPipe) {
_ = tcpconn.CloseRead()
return
}
continue
}
if r.pckt.typ >= packetTypeTop {
if config.ShowDebugLog {
Expand Down

0 comments on commit 4a2b6c3

Please sign in to comment.