From d8e1858fe79e4ccffab5eba2222c9791c546ce4b Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Wed, 13 Nov 2013 09:41:24 +0000 Subject: [PATCH] Revert "htsp: add delayed unsubscription in response to HTSP request" This reverts commit 2c612051f8c12ac746c14bb7de70dc228ef32637. This was done for a reason, but unfortunately it wasn't really done properly and causes some unintended side-effects. The basic principle still needs some looking at, but properly handled differently. --- src/htsp_server.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index a289c266..8c1f2271 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -161,8 +161,6 @@ typedef struct htsp_connection { uint8_t htsp_challenge[32]; - gtimer_t htsp_timer; - } htsp_connection_t; @@ -204,7 +202,6 @@ streaming_target_t *hs_transcoder; uint32_t hs_filtered_streams[16]; // one bit per stream int hs_first; - int hs_unsubscribe; } htsp_subscription_t; @@ -1419,8 +1416,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in) if(normts) st = hs->hs_tsfix = tsfix_create(st); - tvhdebug("htsp", "%s - subscribe to %s", htsp->htsp_logname, - channel_get_name(ch)); + tvhdebug("htsp", "%s - subscribe to %s\n", htsp->htsp_logname, ch->ch_name ?: ""); hs->hs_s = subscription_create_from_channel(ch, weight, htsp->htsp_logname, st, 0, @@ -1430,19 +1426,6 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in) return NULL; } -static void -htsp_unsubscribe_timer ( void *p ) -{ - htsp_connection_t *htsp = p; - htsp_subscription_t *s, *n; - - for (s = LIST_FIRST(&htsp->htsp_subscriptions); s != NULL; s = n) { - n = LIST_NEXT(s, hs_link); - if (s->hs_unsubscribe) - htsp_subscription_destroy(htsp, s); - } -} - /** * Request unsubscription for a channel */ @@ -1468,11 +1451,7 @@ htsp_method_unsubscribe(htsp_connection_t *htsp, htsmsg_t *in) if(s == NULL) return NULL; /* Subscription did not exist, but we don't really care */ - s->hs_unsubscribe = 1; - subscription_change_weight(s->hs_s, SUBSCRIPTION_PRIO_MIN); - // Note: fake unsubscribe (Note: don't set to 0 else other - // background tasks could steal the tuner) - gtimer_arm(&htsp->htsp_timer, htsp_unsubscribe_timer, htsp, 2); + htsp_subscription_destroy(htsp, s); return NULL; } @@ -2128,8 +2107,6 @@ htsp_serve(int fd, void **opaque, struct sockaddr_storage *source, *opaque = NULL; - gtimer_disarm(&htsp.htsp_timer); - /* Beware! Closing subscriptions will invoke a lot of callbacks down in the streaming code. So we do this as early as possible to avoid any weird lockups */