TT#14008 add explicit lws_cancel_service at shutdown

Newer libwebsockets versions seem to use a longer internal timeout, so
an explicit "interrupt" is needed during shutdown to prevent a long wait
time.

Change-Id: I8f28ef658169178e35b40dd44520fbd7c812b590
pull/1546/head
Richard Fuchs 3 years ago
parent 02adda7846
commit 9eb7b640c2

@ -1343,12 +1343,14 @@ int main(int argc, char **argv) {
// reap threads as they shut down during run time
threads_join_all(false);
service_notify("STOPPING=1\n");
// free libevent
#if LIBEVENT_VERSION_NUMBER >= 0x02010100
libevent_global_shutdown();
#endif
service_notify("STOPPING=1\n");
websocket_stop();
if (!is_addr_unspecified(&rtpe_config.redis_ep.address) && initial_rtpe_config.redis_delete_async)
redis_async_event_base_action(rtpe_redis_write, EVENT_BASE_LOOPBREAK);

@ -1077,3 +1077,8 @@ void websocket_start(void) {
return;
thread_create_detach_prio(websocket_loop, NULL, rtpe_config.scheduling, rtpe_config.priority, "websocket");
}
void websocket_stop(void) {
if (!websocket_context)
return;
lws_cancel_service(websocket_context);
}

@ -35,6 +35,7 @@ struct websocket_message {
int websocket_init(void);
void websocket_start(void);
void websocket_stop(void);
// appends to output buffer without triggering a response
void websocket_queue_raw(struct websocket_conn *wc, const char *msg, size_t len);

Loading…
Cancel
Save