Subject: [PATCH] Because of nonblocking sockets reading from proxy might not
work in one turn. We should check for EAGAIN.
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");