diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-07-24 14:25:07 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-07-24 14:25:07 +0000 |
commit | 9343c54040883483b20824ad50252e64b348a1cd (patch) | |
tree | 5a62af8c06f5c311d9f501a4bd3edbe48a6b4baf | |
parent | e5b9fd0d6cd9a16984313ee553a2ff2b4f490df6 (diff) | |
download | php-git-9343c54040883483b20824ad50252e64b348a1cd.tar.gz |
Fixed bug #41984 (Hangs on large SoapClient requests)
-rw-r--r-- | main/streams/xp_socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index ed3c0b2e18..7dc456e06b 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -31,6 +31,10 @@ #include <sys/un.h> #endif +#ifndef MSG_DONTWAIT +# define MSG_DONTWAIT 0 +#endif + php_stream_ops php_stream_generic_socket_ops; PHPAPI php_stream_ops php_stream_socket_ops; php_stream_ops php_stream_udp_socket_ops; @@ -59,7 +63,7 @@ static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count ptimeout = &sock->timeout; retry: - didwrite = send(sock->socket, buf, count, 0); + didwrite = send(sock->socket, buf, count, (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0); if (didwrite <= 0) { long err = php_socket_errno(); @@ -148,7 +152,7 @@ static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS return 0; } - nr_bytes = recv(sock->socket, buf, count, 0); + nr_bytes = recv(sock->socket, buf, count, (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0); stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)); |