From 28b12ad0af05a517ebd881c2cbe517da7d18bab4 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 23 Mar 2014 12:02:52 +0800 Subject: [PATCH] ssl output handle want read write Signed-off-by: Andy Green --- lib/output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/output.c b/lib/output.c index e18a09a0..cad68976 100644 --- a/lib/output.c +++ b/lib/output.c @@ -157,9 +157,12 @@ int lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len) n = SSL_write(wsi->ssl, buf, len); lws_latency(context, wsi, "SSL_write lws_issue_raw", n, n >= 0); if (n < 0) { - if (LWS_ERRNO == LWS_EAGAIN || LWS_ERRNO == LWS_EINTR) { + n = SSL_get_error(wsi->ssl, n); + if (n == SSL_ERROR_WANT_READ || + n == SSL_ERROR_WANT_WRITE) { n = 0; goto handle_truncated_send; + } lwsl_debug("ERROR writing to socket\n"); return -1;