[PHP-DEV] PHP 4.0 Bug #8994: socket_set_timeout works only once From: tom.anheyer <email protected>
Date: 01/30/01

From: tom.anheyer <email protected>
Operating system: Any
PHP version: 4.0.4pl1
PHP Bug Type: Network related
Bug description: socket_set_timeout works only once

socket_set_timeout() works only once.
This is because the internal function php_sock_fgets() checks the timout flag before calling php_sockread_internal(). If blocking IO php_sockwait_for_data() is called next. This function resets the socket timeout flag.

A possible solution is to reset the flag in php_sockset_timeout() like the following patch. Removing the timeout flag test from php_sock_fgets() is also possible maybe.

diff -c /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c-orig /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c
*** /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c-orig Tue Jan 30 11:19:59 2001
--- /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c Tue Jan 30 11:19:59 2001
***************
*** 596,601 ****
--- 596,602 ----
          SOCK_FIND(sock, socket);
  
          sock->timeout = *timeout;
+ sock->timeout_event = 0;
  }
  
  #define SOCK_FIND_AND_READ_MAX(max) \

-- 
Edit Bug report at: http://bugs.php.net/?id=8994&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>