Skip to content

Commit e69af46

Browse files
committed
php#53: * fix php_accept_connect for accept4
1 parent a9d35b4 commit e69af46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/sockets/sockets.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ static bool php_accept_connect(php_socket *in_sock, php_socket *out_sock, struct
297297
flags |= SOCK_NONBLOCK;
298298
}
299299

300+
/*
301+
* This code requires optimization:
302+
* Caching the POLL descriptor
303+
* Properly setting the socket to non-blocking mode, with fewer calls
304+
*/
300305
if (in_sock->blocking && ZEND_ASYNC_IS_ACTIVE && network_async_ensure_socket_nonblocking(in_sock->bsd_socket)) {
301306
out_sock->bsd_socket = accept4(in_sock->bsd_socket, la, la_len, flags);
302307

@@ -2167,7 +2172,7 @@ PHP_FUNCTION(socket_sendto)
21672172
RETURN_THROWS();
21682173
}
21692174
2170-
memset(&sll, 0, sizeof(sll));
2175+
memset(&sll, 0, sizeof(sll));
21712176
sll.sll_family = AF_PACKET;
21722177
sll.sll_ifindex = port;
21732178

0 commit comments

Comments
 (0)