com php-src: Updated to fix async reads/writes.: ext/openssl/xp _ssl.c
| From: | rdlowrey@php.net | Date: | Mon, 21 Jan 2013 16:35:58 +0000 |
| Subject: | com php-src: Updated to fix async reads/writes.: ext/openssl/xp _ssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84339@lists.php.net to get a copy of this message | ||
Commit: fae955a1ae8705f39abc7df545cc9361c79e656c
Author: Brad Broerman <bbroerman@bbroerman.net> Mon, 21 Jan 2013 11:35:58 -0500
Parents: 277efaffaba80bd0052587d8b445ec84a2c8c885
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fae955a1ae8705f39abc7df545cc9361c79e656c
Log:
Updated to fix async reads/writes.
Changed paths:
M ext/openssl/xp_ssl.c
Diff:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 6f9a45a..6445bce 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -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( retry ) {
+ if( retry && blocked ) {
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
(POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
}
@@ -249,9 +249,10 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf,
size
if( err == SSL_ERROR_NONE )
break;
-
- php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
- (POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
+ if( blocked ) {
+ php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ?
+ (POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL);
+ }
}
} while(retry);
@@ -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));
- if( retry ) {
+ if( retry && blocked ) {
php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
(POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
}
@@ -358,9 +359,10 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t
coun
if( err == SSL_ERROR_NONE )
break;
-
- php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
- (POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
+ if( blocked ) {
+ php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ?
+ (POLLOUT|POLLPRI) : (POLLIN|POLLPRI), has_timeout ? &left_time : NULL);
+ }
}
} 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);
sslsock->s.is_blocked = 1;
}
- }
- else
- {
+ } else {
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
*/
+