Skip to content

Commit

Permalink
fix HeartbeatCodec may be make so many goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Feb 3, 2025
1 parent 0bf1bbb commit b425e4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion util/net/heartbeat_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ func (s *HeartbeatCodec) Write(b []byte) (n int, err error) {
}
p.Submit(func() {
defer func() {
close(done)
//put msg buffer back to pool
msg.PutBackBytesBuf()
close(done)
}()
n, err = s.Conn.Write(msg.Bytes())
if err == nil {
Expand All @@ -285,6 +285,7 @@ func (s *HeartbeatCodec) Close() (err error) {
err = s.Conn.Close()
s.readPool.Stop()
s.writePool.Stop()
s.writeHbPool.Stop()
})
return
}
Expand Down

0 comments on commit b425e4f

Please sign in to comment.