Report error from socket read on timeout

A timeout is not considered a transient error (at the socket layer),
and should return -1 rather than 0.
This commit is contained in:
Nikita Popov committed 2021-05-19 15:29:16 +02:00
1 parent 4c15dffe3a
commit 23c90dcdfb
2 files changed
+2 -2

No files matched your search

@@ -20,4 +20,4 @@ fclose($server);
?>
--EXPECT--
string(0) ""
bool(false)
+1 -1
View File
@@ -163,7 +163,7 @@ static ssize_t php_sockop_read(php_stream *stream, char *buf, size_t count)
if (sock->is_blocked) {
php_sock_stream_wait_for_data(stream, sock);
if (sock->timeout_event)
return 0;
return -1;
}
nr_bytes = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(count), (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0);