]> prime8.dev >> repos - ttyd.git/commitdiff
protocol: fix lws callback compatibility
authorShuanglei Tao <tsl0922@gmail.com>
Tue, 10 Mar 2020 01:41:35 +0000 (09:41 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Tue, 10 Mar 2020 01:41:35 +0000 (09:41 +0800)
src/protocol.c

index 478c0df8dbbaa3b2115c0ed4d26da3d7c7e9b9df..aa7eeb6f468d01cf9ec94c4b277606718411d37d 100644 (file)
@@ -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) {