1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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.
This commit is contained in:
shys 2013-10-25 15:50:21 +02:00 committed by Andy Green
parent 5efcb3f7de
commit cfa8ac34c7

View file

@ -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");