2 suggestions
Optional improvements
[suggestion] · Urgent-data tests do not directly cover suppressed select exceptions
The non-Windows P2P progress and byte-accounting checks would still pass if select exception monitoring returned on macOS/BSD, leaving unnecessary wakeups without reliable regression coverage.
Location: src/util/sock.cpp:219 (head).
Details and suggested fix
On non-Windows select platforms, the P2P handler ignores ErrorEvent, so restoring exception monitoring could leave version processing and bytesrecv unchanged while select() repeatedly wakes on pending urgent data. Linux uses poll() and does not exercise this change. HTTP might catch restored exception reporting, but that depends on whether read readiness accompanies the exception. Add a sock_tests.cpp case using TcpSocketPair: send one byte with MSG_OOB and no ordinary data, require a bounded Wait(timeout, Sock::RecvEvent, &occurred) to succeed, and assert ErrorEvent on Windows and its absence elsewhere. The existing wait case sends ordinary data and discards the result. Because exception-result handling has a separate WIN32 guard, checking the mask alone would miss restoration of just FD_SET(s, &err): that can return early with occurred == 0. A non-Windows elapsed-time assertion could cover that case too, at the cost of timing sensitivity. Keep the functional checks for end-to-end progress and byte accounting.
[suggestion] · The poll error comment conflates requested and returned POLLIN
The new comment describes requested read interest, but the early-disconnect condition depends on whether poll() actually returned POLLIN alongside the error or hangup.
Location: src/net.cpp:2218 (head).
Details and suggested fix
recvSet comes from events.occurred, and WaitMany() sets RecvEvent only when POLLIN appears in revents. Thus errorSet && !recvSet also disconnects when POLLIN was requested but not returned; paused receiving is one way to reach the branch, not the only one. Describe the returned events instead: when poll() also reports POLLIN, the receive path can drain buffered data before detecting the disconnect, subject to the send path; otherwise, including when receiving is paused and POLLIN was not requested, disconnect now. This is a comment clarification only. Source inspection does not establish how often Linux returns an error or hangup without requested POLLIN.