Skip to content

Commit dd52162

Browse files
committed
fix: cancel netconn contexts after close handshake
1 parent cef8e11 commit dd52162

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

netconn.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@ type netConn struct {
115115
var _ net.Conn = &netConn{}
116116

117117
func (nc *netConn) Close() error {
118-
nc.writeTimer.Stop()
119-
nc.writeCancel()
120-
nc.readTimer.Stop()
121-
nc.readCancel()
118+
defer func() {
119+
nc.writeTimer.Stop()
120+
nc.writeCancel()
121+
nc.readTimer.Stop()
122+
nc.readCancel()
123+
}()
122124
return nc.c.Close(StatusNormalClosure, "")
123125
}
124126

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy