Skip to content

Commit e46b987

Browse files
author
Maurits Dijkstra
committed
Fix EINPROGRESS very rarely occurring in php_network_connect_socket in synchronous mode
1 parent 670052c commit e46b987

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

main/network.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd,
361361
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) != 0) {
362362
ret = -1;
363363
}
364+
if (error == EINPROGRESS) {
365+
/* Is leftover from the earlier connect call, since php_socket_errno
366+
* does not clear it. */
367+
error = 0;
368+
}
364369
} else {
365370
/* whoops: sockfd has disappeared */
366371
ret = -1;

0 commit comments

Comments
 (0)