]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
webui: streaming - fix the removed scoped lock, fixes #5356
authorJaroslav Kysela <perex@perex.cz>
Tue, 27 Nov 2018 16:16:43 +0000 (17:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 27 Nov 2018 16:16:43 +0000 (17:16 +0100)
src/webui/statedump.c
src/webui/webui.c

index 0be3f6ac49f17faf95dbcb5ca11493191d381ce9..ea2bb033e3dbfe61a0690b215fbfa47c78f447b1 100644 (file)
@@ -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;
index 5732a3ce0492a24f466289e77b208859a08fdfa3..1a755581c0e797b844c0465935e69f2c9a483ac6 100644 (file)
@@ -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;
 }
 
 /**