case PHP_STREAM_OPTION_CHECK_LIVENESS:
{
fd_set rfds;
- struct timeval tv = {0,0};
+ struct timeval tv;
char buf;
int alive = 1;
+ if (sslsock->s.timeout.tv_sec == -1) {
+ tv.tv_sec = FG(default_socket_timeout);
+ } else {
+ tv = sslsock->s.timeout;
+ }
+
if (sslsock->s.socket == -1) {
alive = 0;
} else {
return 0;
}
+ if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR ==
+ php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS,
+ 0, NULL)) {
+ stream->eof = 1;
+ }
+
return stream->eof;
}
break;
default:
- ret = PHP_STREAM_OPTION_RETURN_ERR;
+ ;
}
}
case PHP_STREAM_OPTION_CHECK_LIVENESS:
{
fd_set rfds;
- struct timeval tv = {0,0};
+ struct timeval tv;
char buf;
int alive = 1;
+ if (sock->timeout.tv_sec == -1) {
+ tv.tv_sec = FG(default_socket_timeout);
+ } else {
+ tv = sock->timeout;
+ }
+
if (sock->socket == -1) {
alive = 0;
} else {