Commit 7e482c5
committed
fix(client): wake a blocked Windows recv on closeTraffic
On POSIX, shutdown(SHUT_RDWR) unblocks a recv() already in progress on
another thread, which is how closeTraffic() wakes a worker parked in recv
without releasing the fd. Winsock's shutdown(SD_BOTH) does not do this: an
already-blocked recv() stays parked until data arrives, the peer resets, or
the socket is closed. That left the QWP I/O worker stuck and failed
SocketTrafficShutdownTest.testPlainSocketShutdownWakesWindowsRecvAndRetainsFd
on the windows-msvc-2022-x64 job.
Cancel outstanding I/O on the socket handle with CancelIoEx before the
shutdown(). This wakes the blocked recv() while leaving the descriptor
allocated, so the fd is retained (no reuse race) until close() releases it,
matching the POSIX/macOS behaviour the sibling tests already rely on.
Net.shutdown() is only reached via PlainSocket.closeTraffic(), so no other
caller is affected.1 parent ca7a2da commit 7e482c5
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
| |||
0 commit comments