Skip to content

Commit 11edf6b

Browse files
committed
fix: delete fd
1 parent f8c1059 commit 11edf6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

connstate/conn.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ func ListenConnState(conn net.Conn) (ConnStater, error) {
6363
})
6464
if fd != nil {
6565
if err != nil && opAddErr == nil {
66-
_ = poll.control(fd, opDel)
66+
// if rawConn is closed, poller will delete the fd by itself
67+
_ = rawConn.Control(func(_ uintptr) {
68+
_ = poll.control(fd, opDel)
69+
})
6770
}
6871
if err != nil || opAddErr != nil {
6972
atomic.StorePointer(&fd.conn, nil)

0 commit comments

Comments
 (0)