]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http server: improve shutdown for streaming
authorJaroslav Kysela <perex@perex.cz>
Sun, 26 Oct 2014 20:01:20 +0000 (21:01 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 26 Oct 2014 20:43:08 +0000 (21:43 +0100)
src/http.c
src/http.h
src/webui/webui.c

index 8fc9ff47f2be02dd0fce5fd0f4514aa70ce5701d..7236b7e8aacea4cb89300b147709ac92348323ea 100644 (file)
@@ -1016,8 +1016,10 @@ http_cancel( void *opaque )
 {
   http_connection_t *hc = opaque;
 
-  if (hc)
+  if (hc) {
     shutdown(hc->hc_fd, SHUT_RDWR);
+    hc->hc_shutdown = 1;
+  }
 }
 
 /**
index 010ea6a9914843a5e6f8bedb0b32943b48de81d7..388d59e2347483c72c927d9c593546b9a5eec28b 100644 (file)
@@ -137,14 +137,13 @@ typedef struct http_connection {
 
   int hc_no_output;
   int hc_logout_cookie;
+  int hc_shutdown;
 
   /* Support for HTTP POST */
   
   char *hc_post_data;
   unsigned int hc_post_len;
 
-  struct rtsp *hc_rtsp_session;
-
 } http_connection_t;
 
 
index 7c23128a24a1b633b5f35b7cbf7315f4acee05ab..eba5dbb6a35f813808b50afd2d61f16712ffb912 100644 (file)
@@ -253,7 +253,7 @@ http_stream_run(http_connection_t *hc, profile_chain_t *prch,
   tp.tv_usec = 0;
   setsockopt(hc->hc_fd, SOL_SOCKET, SO_SNDTIMEO, &tp, sizeof(tp));
 
-  while(run && tvheadend_running) {
+  while(!hc->hc_shutdown && run && tvheadend_running) {
     pthread_mutex_lock(&sq->sq_mutex);
     sm = TAILQ_FIRST(&sq->sq_queue);
     if(sm == NULL) {