Skip to content

Commit

Permalink
fix(p2p): wrong issub init
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Aug 7, 2024
1 parent b0667d5 commit aa6f5ee
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gold/p2p/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
}

if issub {
defer conn.peers.Delete(ep.String())
} else {
defer func() {
conn.sblk.Lock()
for i, sub := range conn.subs {
Expand All @@ -194,6 +192,8 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
}
conn.sblk.Unlock()
}()
} else {
defer conn.peers.Delete(ep.String())
}

go conn.keep(ep)
Expand Down Expand Up @@ -242,9 +242,8 @@ func (conn *Conn) receive(tcpconn *net.TCPConn, hasvalidated bool) {
if config.ShowDebugLog {
logrus.Debugln("[tcp] recv from", ep, "err:", err)
}
// _ = tcpconn.CloseRead()
// return
continue
_ = tcpconn.CloseRead()
return
}
if r.pckt.typ >= packetTypeTop {
if config.ShowDebugLog {
Expand Down

0 comments on commit aa6f5ee

Please sign in to comment.