mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Updated to fix async reads/writes.
This commit is contained in:
parent
277efaffab
commit
fae955a1ae
1 changed files with 12 additions and 11 deletions
|
@ -240,7 +240,7 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
|
||||||
|
|
||||||
if( errno == EAGAIN && ( err == SSL_ERROR_WANT_READ || SSL_ERROR_WANT_WRITE ) ) retry = 1;
|
if( errno == EAGAIN && ( err == SSL_ERROR_WANT_READ || SSL_ERROR_WANT_WRITE ) ) retry = 1;
|
||||||
|
|
||||||
if( retry ) {
|
if( retry && blocked ) {
|
||||||
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
|
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
|
||||||
(POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
|
(POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
|
||||||
}
|
}
|
||||||
|
@ -249,10 +249,11 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
|
||||||
|
|
||||||
if( err == SSL_ERROR_NONE )
|
if( err == SSL_ERROR_NONE )
|
||||||
break;
|
break;
|
||||||
|
if( blocked ) {
|
||||||
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
|
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
|
||||||
(POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
|
(POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while(retry);
|
} while(retry);
|
||||||
|
|
||||||
if( blocked ) {
|
if( blocked ) {
|
||||||
|
@ -347,7 +348,7 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t coun
|
||||||
|
|
||||||
stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle));
|
stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle));
|
||||||
|
|
||||||
if( retry ) {
|
if( retry && blocked ) {
|
||||||
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
|
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
|
||||||
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
|
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
|
||||||
}
|
}
|
||||||
|
@ -358,10 +359,11 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t coun
|
||||||
|
|
||||||
if( err == SSL_ERROR_NONE )
|
if( err == SSL_ERROR_NONE )
|
||||||
break;
|
break;
|
||||||
|
if( blocked ) {
|
||||||
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
|
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
|
||||||
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
|
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} while (retry);
|
} while (retry);
|
||||||
|
|
||||||
|
@ -373,9 +375,7 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t coun
|
||||||
php_set_sock_blocking(sslsock->s.socket, 1 TSRMLS_CC);
|
php_set_sock_blocking(sslsock->s.socket, 1 TSRMLS_CC);
|
||||||
sslsock->s.is_blocked = 1;
|
sslsock->s.is_blocked = 1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC);
|
nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,3 +1104,4 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen,
|
||||||
* vim<600: noet sw=4 ts=4
|
* vim<600: noet sw=4 ts=4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue