From: Seonah Moon Date: Tue, 28 Sep 2021 11:43:06 +0000 (+0900) Subject: Return non-zero in lws callback when close request X-Git-Tag: submit/tizen/20211012.073313^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42b8270ac39b35517710f34918f55f49ad21e52f;p=platform%2Fcore%2Fapi%2Fvine.git Return non-zero in lws callback when close request Change-Id: I230b34d087137fa65f762c9148339d2fe43aece2 --- diff --git a/plugins/libwebsockets/libwebsockets-plugin.cpp b/plugins/libwebsockets/libwebsockets-plugin.cpp index 096fcf3..428a445 100755 --- a/plugins/libwebsockets/libwebsockets-plugin.cpp +++ b/plugins/libwebsockets/libwebsockets-plugin.cpp @@ -297,7 +297,7 @@ static void _destroy_websocket(websocket_s *ws) if (!ws) return; - VINE_LOGD("ws[%s] is destroyed.", ws); + VINE_LOGD("ws[%p] is destroyed.", ws); ws->wsi = NULL; ws->vh = NULL; @@ -457,8 +457,18 @@ static int _websocket_protocol_cb(struct lws *wsi, lws_get_protocol(wsi)); // host private data. int n = 0; + if (ws && ws->close_requested + && reason != LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS) { + VINE_LOGD("ws[%p](user: %p) will be closed. Do nothing for it.", ws, ws->user); + return -1; + } + switch (reason) { - case LWS_CALLBACK_FILTER_NETWORK_CONNECTION : + case LWS_CALLBACK_WSI_DESTROY: + VINE_LOGI("wsi[%p](ws: %p) is destroyed.", wsi, ws); + break; + + case LWS_CALLBACK_FILTER_NETWORK_CONNECTION: if (vhd && vhd->max_conn > 0 && vhd->max_conn <= vhd->curr_conn) { VINE_LOGI("The max connection limit[%d] is reached. Reject the request.", vhd->max_conn);