1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-12 12:50:28 +08:00

fix(p2p): wrong issub init

This commit is contained in:
源文雨
2024-08-07 22:56:02 +08:00
parent b0667d5a45
commit aa6f5ee100

View File

@@ -182,8 +182,6 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
} }
if issub { if issub {
defer conn.peers.Delete(ep.String())
} else {
defer func() { defer func() {
conn.sblk.Lock() conn.sblk.Lock()
for i, sub := range conn.subs { for i, sub := range conn.subs {
@@ -194,6 +192,8 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
} }
conn.sblk.Unlock() conn.sblk.Unlock()
}() }()
} else {
defer conn.peers.Delete(ep.String())
} }
go conn.keep(ep) go conn.keep(ep)
@@ -242,9 +242,8 @@ 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() _ = tcpconn.CloseRead()
// return return
continue
} }
if r.pckt.typ >= packetTypeTop { if r.pckt.typ >= packetTypeTop {
if config.ShowDebugLog { if config.ShowDebugLog {