From: Shuanglei Tao Date: Tue, 10 Mar 2020 01:41:35 +0000 (+0800) Subject: protocol: fix lws callback compatibility X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=48f53bcc000fb73b3fd68f051a3c3c9a80b78b02;p=ttyd.git protocol: fix lws callback compatibility --- diff --git a/src/protocol.c b/src/protocol.c index 478c0df..aa7eeb6 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -419,6 +419,9 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason, break; case LWS_CALLBACK_CLOSED: + if (pss->wsi == NULL) + break; + server->client_count--; lwsl_notice("WS closed from %s, clients: %d\n", pss->address, server->client_count); if (pss->buffer != NULL) {