Skip to content

Commit da1013b

Browse files
committed
changes from feedback
1 parent f086596 commit da1013b

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
@@ -284,7 +284,12 @@ static bool php_open_listen_sock(php_socket *sock, unsigned short port, int back
284284
static bool php_accept_connect(php_socket *in_sock, php_socket *out_sock, struct sockaddr *la, socklen_t *la_len) /* {{{ */
285285
{
286286
#if defined(HAVE_ACCEPT4)
287-
out_sock->bsd_socket = accept4(in_sock->bsd_socket, la, la_len, SOCK_CLOEXEC);
287+
int flags = SOCK_CLOEXEC;
288+
if (!in_sock->blocking) {
289+
flags |= SOCK_NONBLOCK;
290+
}
291+
292+
out_sock->bsd_socket = accept4(in_sock->bsd_socket, la, la_len, flags);
288293

289294
if (IS_INVALID_SOCKET(out_sock)) {
290295
PHP_SOCKET_ERROR(out_sock, "unable to accept incoming connection", errno);

0 commit comments

Comments
 (0)