From: Jaroslav Kysela Date: Tue, 27 Nov 2018 16:16:43 +0000 (+0100) Subject: webui: streaming - fix the removed scoped lock, fixes #5356 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0c65b0cc58ba095dcca6d985777a6b8e5250358;p=thirdparty%2Ftvheadend.git webui: streaming - fix the removed scoped lock, fixes #5356 --- diff --git a/src/webui/statedump.c b/src/webui/statedump.c index 0be3f6ac4..ea2bb033e 100644 --- a/src/webui/statedump.c +++ b/src/webui/statedump.c @@ -162,7 +162,9 @@ page_statedump(http_connection_t *hc, const char *remain, void *opaque) tvh_binshasum[18], tvh_binshasum[19]); + tvh_mutex_lock(&global_lock); dumpchannels(hq); + tvh_mutex_unlock(&global_lock); http_output_content(hc, "text/plain; charset=UTF-8"); return 0; diff --git a/src/webui/webui.c b/src/webui/webui.c index 5732a3ce0..1a755581c 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1350,7 +1350,7 @@ http_stream(http_connection_t *hc, const char *remain, void *opaque) mpegts_mux_t *mm = NULL; #endif const char *str; - int weight = 0; + int weight = 0, r; hc->hc_keep_alive = 0; @@ -1365,6 +1365,8 @@ http_stream(http_connection_t *hc, const char *remain, void *opaque) if ((str = http_arg_get(&hc->hc_req_args, "weight"))) weight = atoi(str); + tvh_mutex_lock(&global_lock); + if(!strcmp(components[0], "channelid")) { ch = channel_find_by_id(atoi(components[1])); } else if(!strcmp(components[0], "channelnumber")) { @@ -1383,16 +1385,19 @@ http_stream(http_connection_t *hc, const char *remain, void *opaque) } if(ch != NULL) { - return http_stream_channel(hc, ch, weight); + r = http_stream_channel(hc, ch, weight); } else if(service != NULL) { - return http_stream_service(hc, service, weight); + r = http_stream_service(hc, service, weight); #if ENABLE_MPEGTS } else if(mm != NULL) { - return http_stream_mux(hc, mm, weight); + r = http_stream_mux(hc, mm, weight); #endif } else { - return HTTP_STATUS_BAD_REQUEST; + r = HTTP_STATUS_BAD_REQUEST; } + + tvh_mutex_unlock(&global_lock); + return r; } /**