1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-22 11:30:31 +08:00

fix(p2p): close receive on certain errors

This commit is contained in:
源文雨
2024-08-08 13:26:20 +08:00
parent d5d7a9412f
commit 4a2b6c3f90

View File

@@ -242,8 +242,11 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
if config.ShowDebugLog { if config.ShowDebugLog {
logrus.Debugln("[tcp] recv from", ep, "err:", err) logrus.Debugln("[tcp] recv from", ep, "err:", err)
} }
_ = tcpconn.CloseRead() if errors.Is(err, net.ErrClosed) || errors.Is(err, io.ErrClosedPipe) {
return _ = tcpconn.CloseRead()
return
}
continue
} }
if r.pckt.typ >= packetTypeTop { if r.pckt.typ >= packetTypeTop {
if config.ShowDebugLog { if config.ShowDebugLog {