Repository navigation
Commit 373984a
committed
Fix the foreign-peer test on Linux: accept the real connection first
_loopback_socketpair() connects with setblocking(False) -- the same trick
CPython's own fallback uses -- and counts on the accept() that follows to
wait for the handshake, because only then is getpeername() meaningful.
The hijacked _accept() here returned a foreign peer without waiting, so on
Linux csock was still in SYN_SENT when the CVE check called getpeername()
and the test failed with ENOTCONN instead of the ConnectionError it is
about. Windows connects to the loopback synchronously and never showed it.
Drain the real connection inside the hijack, then close it.
Signed-off-by: Simin Yuan <281164480+simin-yuan@users.noreply.github.com>1 parent 49f8b59 commit 373984a
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
94 | 108 | | |
95 | 109 | | |
96 | 110 | | |
| |||
0 commit comments