From 7c15eb1e427d8677a3f64e333f30afcc9e5bd4de Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 14 Jan 2016 11:38:31 +0800 Subject: [PATCH] only report CLIENT_CONNECTION_ERROR once on some paths In most cases the close api will see it should send the CCE because we are still in the waiting server reply state until the end of the interpretation. Only if we completed the interpretation and moved on to ESTABLISHED do we need to handle sending it ourselves. Signed-off-by: Andy Green --- lib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.c b/lib/client.c index 40c2391e..a8f36738 100644 --- a/lib/client.c +++ b/lib/client.c @@ -855,7 +855,7 @@ bail3: close_reason = LWS_CLOSE_STATUS_NOSTATUS; bail2: - if (wsi->protocol) { + if (wsi->protocol && wsi->state == LWSS_ESTABLISHED) { if (isErrorCodeReceived && p) { wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_CONNECTION_ERROR,