com php-src: Fixed bug #70198 Checking liveness does not work as expected: main/streams/xp_socket.c
| From: | Anatol Belski | Date: | Tue, 11 Aug 2015 15:36:10 +0000 |
| Subject: | com php-src: Fixed bug #70198 Checking liveness does not work as expected: main/streams/xp_socket.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88476@lists.php.net to get a copy of this message | ||
Commit: 797e30f4fc9fae94b92e314aac9a16cff2d5b50b
Author: Anatol Belski <ab@php.net> Tue, 11 Aug 2015 17:36:10 +0200
Parents: 87db2e4a9157d8875cffa119f21f9e356713a511
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=797e30f4fc9fae94b92e314aac9a16cff2d5b50b
Log:
Fixed bug #70198 Checking liveness does not work as expected
Bugs:
https://bugs.php.net/70198
Changed paths:
M main/streams/xp_socket.c
Diff:
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index ee06f26..c4846d8 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -293,7 +293,17 @@ static int php_sockop_set_option(php_stream *stream, int option, int value,
void
if (sock->socket == -1) {
alive = 0;
} else if (php_pollfd_for(sock->socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
- if (0 >= recv(sock->socket, &buf, sizeof(buf), MSG_PEEK) &&
php_socket_errno() != EWOULDBLOCK) {
+#ifdef PHP_WIN32
+ int ret;
+#else
+ ssize_t ret;
+#endif
+ int err;
+
+ ret = recv(sock->socket, &buf, sizeof(buf), MSG_PEEK);
+ err = php_socket_errno();
+ if (0 == ret || /* the counterpart did properly shutdown*/
+ 0 > ret && err != EWOULDBLOCK && err != EAGAIN) { /* there was an
unrecoverable error */
alive = 0;
}
}