aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshys <shyswork@zoho.com>2013-10-25 15:50:21 +0200
committerAndy Green <andy.green@linaro.org>2013-10-25 22:30:25 +0800
commitcfa8ac34c7693d0194e62856c848f9c4430061bf (patch)
treecda0b0c19587af5ac25c6bf76560d9bc664f952e /lib
parent5efcb3f7dec0d284aa89d5fc179de70d0405b52c (diff)
downloadlibwebsockets-cfa8ac34c7693d0194e62856c848f9c4430061bf.tar.gz
cover-proxy-read-EAGAIN.patch
Subject: [PATCH] Because of nonblocking sockets reading from proxy might not work in one turn. We should check for EAGAIN.
Diffstat (limited to 'lib')
-rw-r--r--lib/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/client.c b/lib/client.c
index 561c009f..7e81df5b 100644
--- a/lib/client.c
+++ b/lib/client.c
@@ -78,6 +78,13 @@ int lws_client_socket_service(struct libwebsocket_context *context,
n = recv(wsi->sock, context->service_buffer,
sizeof(context->service_buffer), 0);
if (n < 0) {
+
+ if (errno == EAGAIN) {
+ lwsl_debug(
+ "Proxy read returned EAGAIN... retrying\n");
+ return 0;
+ }
+
libwebsocket_close_and_free_session(context, wsi,
LWS_CLOSE_STATUS_NOSTATUS);
lwsl_err("ERROR reading from proxy socket\n");