Repository navigation
Commit ec8db37
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 c792847 commit ec8db37
2 files changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
415 | 422 | | |
416 | 423 | | |
417 | 424 | | |
| |||
0 commit comments