From 8294c1fa4f6485fa6c5f15078d609f62b3026d98 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Sat, 29 Jun 2013 10:22:09 +0800 Subject: [PATCH] Request "send" not to trigger SIGPIPE on errors. --- lib/client-handshake.c | 2 +- lib/client.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client-handshake.c b/lib/client-handshake.c index de99a208..2dd810c5 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -85,7 +85,7 @@ struct libwebsocket *__libwebsocket_client_connect_2( if (context->http_proxy_port) { - n = send(wsi->sock, context->service_buffer, plen, 0); + n = send(wsi->sock, context->service_buffer, plen, MSG_NOSIGNAL); if (n < 0) { compatible_close(wsi->sock); lwsl_debug("ERROR writing to proxy socket\n"); diff --git a/lib/client.c b/lib/client.c index b6236a2b..94a66947 100644 --- a/lib/client.c +++ b/lib/client.c @@ -229,7 +229,7 @@ int lws_client_socket_service(struct libwebsocket_context *context, else #endif n = send(wsi->sock, context->service_buffer, - p - (char *)context->service_buffer, 0); + p - (char *)context->service_buffer, MSG_NOSIGNAL); lws_latency(context, wsi, "send or SSL_write LWS_CONNMODE...HANDSHAKE", n, n >= 0);