From 4f16c2eed57b35101d56a979ebfaab8cd4a89bd8 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Sat, 21 Sep 2013 19:45:55 +0100 Subject: [PATCH] epggrab: ensure that grabs that timeout will unsubscribe --- src/epggrab/otamux.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c index 40ee2626..0d314e2f 100644 --- a/src/epggrab/otamux.c +++ b/src/epggrab/otamux.c @@ -104,11 +104,17 @@ epggrab_ota_timeout ( epggrab_ota_mux_t *ota ) static void epggrab_ota_done ( epggrab_ota_mux_t *ota, int timeout ) { + mpegts_mux_t *mm; + LIST_REMOVE(ota, om_q_link); ota->om_active = 0; ota->om_when = dispatch_clock + epggrab_ota_period(ota); LIST_INSERT_SORTED(&epggrab_ota_pending, ota, om_q_link, om_time_cmp); + /* Remove subscriber */ + if ((mm = mpegts_mux_find(ota->om_mux_uuid))) + mpegts_mux_unsubscribe_by_name(mm, "epggrab"); + /* Re-arm */ if (LIST_FIRST(&epggrab_ota_pending) == ota) epggrab_ota_pending_timer_cb(NULL); @@ -236,7 +242,6 @@ epggrab_ota_complete { int done = 1; epggrab_ota_map_t *map; - mpegts_mux_t *mm; tvhinfo(mod->id, "grab complete"); /* Test for completion */ @@ -249,10 +254,6 @@ epggrab_ota_complete } if (!done) return; - /* Remove subscriber */ - if ((mm = mpegts_mux_find(ota->om_mux_uuid))) - mpegts_mux_unsubscribe_by_name(mm, "epggrab"); - /* Done */ epggrab_ota_done(ota, 0); }