only report CLIENT_CONNECTION_ERROR once on some paths
authorAndy Green <andy.green@linaro.org>
Thu, 14 Jan 2016 03:38:31 +0000 (11:38 +0800)
committerAndy Green <andy.green@linaro.org>
Thu, 14 Jan 2016 03:38:31 +0000 (11:38 +0800)
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 <andy.green@linaro.org>
lib/client.c

index 40c2391..a8f3673 100644 (file)
@@ -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,