Skip to content

Commit

Permalink
opt: prevent server-side UDP sockets in eventloop.close() on Windows
Browse files Browse the repository at this point in the history
Follows up #624
  • Loading branch information
panjf2000 committed Jul 3, 2024
1 parent 70472bf commit 42cc9a8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions eventloop_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (el *eventloop) wake(c *conn) error {
}

func (el *eventloop) close(c *conn, err error) error {
if _, ok := el.connections[c]; c.localAddr == nil || !ok {
if _, ok := el.connections[c]; c.rawConn == nil || !ok {
return nil // ignore stale wakes.
}

Expand All @@ -194,9 +194,7 @@ func (el *eventloop) close(c *conn, err error) error {
action := el.eventHandler.OnClose(c, err)
err = nil

if c.rawConn != nil {
err = c.rawConn.Close()
}
err = c.rawConn.Close()
c.release()
if err != nil {
return err
Expand Down

0 comments on commit 42cc9a8

Please sign in to comment.