Skip to content

Commit ee3cc4b

Browse files
authored
Fix CloseNotifyConn.Close function (#5022)
The CloseNotifyConn.Close() function calls itself if the closeFlag is equal to 0 which would mean it would immediately swap the closeFlag value to 1 and never call closeFn. It is unclear what the intent of this call to cc.Close() was but I assume it was meant to be a call to close the Conn object instead.
1 parent e382676 commit ee3cc4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/util/net/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func WrapCloseNotifyConn(c net.Conn, closeFn func()) net.Conn {
149149
func (cc *CloseNotifyConn) Close() (err error) {
150150
pflag := atomic.SwapInt32(&cc.closeFlag, 1)
151151
if pflag == 0 {
152-
err = cc.Close()
152+
err = cc.Conn.Close()
153153
if cc.closeFn != nil {
154154
cc.closeFn()
155155
}

0 commit comments

Comments
 (0)