From 59f3e86d21cb52295e9c682e6b1933231a921094 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 9 Jun 2017 12:02:01 +0200 Subject: [PATCH] web: fix segmention fault during shutdown of web server (closes #93) --- lib/web.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/web.c b/lib/web.c index b437bc27d..26351ebcd 100644 --- a/lib/web.c +++ b/lib/web.c @@ -234,15 +234,16 @@ int web_stop(struct web *w) { info("Stopping Web sub-system"); - if (w->state == STATE_STARTED) + if (w->state == STATE_STARTED) { lws_cancel_service(w->context); - /** @todo Wait for all connections to be closed */ + /** @todo Wait for all connections to be closed */ - pthread_cancel(w->thread); - pthread_join(w->thread, NULL); + pthread_cancel(w->thread); + pthread_join(w->thread, NULL); - w->state = STATE_STOPPED; + w->state = STATE_STOPPED; + } return 0; }