Alternative approach to #36688, citing the relevant parts of its description:
There is currently nothing preventing us to receive TCP urgent data, which would never be returned by
recv(). Linux'spoll()is indifferent to this, but theselect()socket monitoring may keep reporting it as pending on some platforms.This would not prevent progress nor lead to a crash anymore after #36665, but it's still undesirable.
Fix this by ignoring the exceptionSet. Except on Windows, where we instead disconnect if its used.
We could instead have set SO_OOBINLINE on our sockets, so recv() returns any urgent data sent to us (and likely leads us to disconnect the peer). RFC 6093 doesn't forbid this, but the current approach seems more clear and direct to me.
The PR makes two additional changes for clarity:
- wrap the
FD_ISSETcheck in#ifdef WIN32(no behavior change) - instead of
if (recvSet || errorSet), checkerrorSetseparately and earlier (emits a different log message)
Test coverage is introduced in p2p_socket_errors.py.
Finally a similar fix is applied to HTTP.