Skip to content

Commit da4af3e

Browse files
committed
Improve php_openssl_sockop_set_option logic for liveness poll skipping
1 parent 84b570e commit da4af3e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/openssl/xp_ssl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,10 +2399,11 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
23992399

24002400
if (sslsock->s.socket == -1) {
24012401
alive = 0;
2402-
} else if ((!sslsock->ssl_active && value == 0 && (MSG_DONTWAIT || !sslsock->s.is_blocked)) ||
2402+
} else if ((value == 0 && ((!sslsock->ssl_active && MSG_DONTWAIT) || !sslsock->s.is_blocked)) ||
24032403
php_pollfd_for(sslsock->s.socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
2404-
/* the poll() call was skipped if the socket is non-blocking (or MSG_DONTWAIT is available) and if the timeout is zero */
2405-
/* additionally, we don't use this optimization if SSL is active because in that case, we're not using MSG_DONTWAIT */
2404+
/* The poll() call is skipped if the socket is non-blocking (or MSG_DONTWAIT is available)
2405+
* and if the timeout is zero. Additionally for blocking socket we don't use this
2406+
* optimization if SSL is active because in that case we're not using MSG_DONTWAIT. */
24062407
if (sslsock->ssl_active) {
24072408
int n = SSL_peek(sslsock->ssl_handle, &buf, sizeof(buf));
24082409
if (n <= 0) {

0 commit comments

Comments
 (0)