dsp Tue Aug 26 16:06:23 2008 UTC Modified files: /php-src/main/streams streams.c xp_socket.c Log: Fixed bug #43782 (feof() does not detect timeout on socket) # Poll returns 0 if it times out. # We check for 0 and use the user set timeout in set_options by passing -1. http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.168&r2=1.169&diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.168 php-src/main/streams/streams.c:1.169 --- php-src/main/streams/streams.c:1.168 Wed Aug 6 09:03:36 2008 +++ php-src/main/streams/streams.c Tue Aug 26 16:06:23 2008 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.168 2008/08/06 09:03:36 tony2001 Exp $ */ +/* $Id: streams.c,v 1.169 2008/08/26 16:06:23 dsp Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -831,7 +831,7 @@ /* use the configured timeout when checking eof */ if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR == php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, - 0, NULL)) { + -1, NULL)) { stream->eof = 1; } http://cvs.php.net/viewvc.cgi/php-src/main/streams/xp_socket.c?r1=1.47&r2=1.48&diff_format=u Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.47 php-src/main/streams/xp_socket.c:1.48 --- php-src/main/streams/xp_socket.c:1.47 Wed Jul 16 14:08:04 2008 +++ php-src/main/streams/xp_socket.c Tue Aug 26 16:06:23 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.47 2008/07/16 14:08:04 jani Exp $ */ +/* $Id: xp_socket.c,v 1.48 2008/08/26 16:06:23 dsp Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -280,8 +280,12 @@ 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() != EAGAIN) { + } 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() != EAGAIN) { + alive = 0; + } + } else { alive = 0; } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php