]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SAT>IP server: fix shutdown_on_close
authorJaroslav Kysela <perex@perex.cz>
Mon, 30 Nov 2015 19:40:55 +0000 (20:40 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 30 Nov 2015 19:40:55 +0000 (20:40 +0100)
src/satip/rtp.c
src/satip/rtsp.c

index 51e60fb14f2dae33ae5714609e33c48c8cec5155..58d1923236a2d3bd41ba189c6d15a0183503cb1e 100644 (file)
@@ -559,9 +559,11 @@ void satip_rtp_close(void *id)
     pthread_cond_signal(&sq->sq_cond);
     pthread_mutex_unlock(&sq->sq_mutex);
     pthread_mutex_unlock(&satip_rtp_lock);
-    pthread_mutex_lock(rtp->tcp_lock);
+    if (rtp->port == RTSP_TCP_DATA)
+      pthread_mutex_lock(rtp->tcp_lock);
     pthread_join(rtp->tid, NULL);
-    pthread_mutex_unlock(rtp->tcp_lock);
+    if (rtp->port == RTSP_TCP_DATA)
+      pthread_mutex_unlock(rtp->tcp_lock);
     udp_multisend_free(&rtp->um);
     mpegts_pid_done(&rtp->pids);
     while ((tbl = TAILQ_FIRST(&rtp->pmt_tables)) != NULL) {
index 1196d09ee9b723202ff2dd7f1b63d23a7365bc8d..c0e63c943ea30231a066c3a3d92059bf4790e780 100644 (file)
@@ -50,7 +50,7 @@ typedef struct session {
   int findex;
   int src;
   int state;
-  int shutdown_on_close;
+  http_connection_t *shutdown_on_close;
   int perm_lock;
   uint32_t nsession;
   char session[9];
@@ -1080,7 +1080,7 @@ rtsp_parse_cmd
   rs->src = src;
 
   if (cmd < 0)
-    rs->shutdown_on_close = 1;
+    rs->shutdown_on_close = hc;
 
 play:
   if (pids.count > 0)
@@ -1460,9 +1460,12 @@ rtsp_flush_requests(http_connection_t *hc)
   pthread_mutex_lock(&rtsp_lock);
   for (rs = TAILQ_FIRST(&rtsp_sessions); rs; rs = rs_next) {
     rs_next = TAILQ_NEXT(rs, link);
-    if (rs->shutdown_on_close) {
+    if (rs->shutdown_on_close == hc) {
       rtsp_close_session(rs);
       rtsp_free_session(rs);
+    } else {
+      if (rs->rtp_peer_port == RTSP_TCP_DATA)
+        satip_rtp_close((void *)(intptr_t)rs->stream);
     }
   }
   pthread_mutex_unlock(&rtsp_lock);