Repository navigation
Commit 11a58ee
Fix GH-24171: Slow stream_socket_client() connect on Windows
On Windows, php_network_connect_socket() calls getsockopt(SO_ERROR)
right after select() reports that the non-blocking connect completed.
Inside mswsock, SockIsSocketConnected() can then race with mswsock's
own async thread and wait on an internal completion port with a 10 ms
timeout, so the call often blocks for 10-25 ms.
Winsock reports a successful non-blocking connect in writefds and a
failed one in exceptfds, and we already poll for POLLOUT|POLLPRI. So
when only POLLOUT is set, the connect has succeeded and getsockopt()
can be skipped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent c88c89e commit 11a58ee
2 files changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
421 | 428 | | |
422 | 429 | | |
423 | 430 | | |
| |||
0 commit comments