]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epggrab: ota - do not requeue completed muxes
authorJaroslav Kysela <perex@perex.cz>
Tue, 19 Aug 2014 18:11:54 +0000 (20:11 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 19 Aug 2014 18:11:54 +0000 (20:11 +0200)
src/epggrab.h
src/epggrab/otamux.c

index d507ba0479aa0ebdecd74eaea2b18a79f20f16b1..b3a5a95a8af7fe6e59b2336b481f435b4f01d29f 100644 (file)
@@ -202,6 +202,7 @@ struct epggrab_ota_mux
   char                              *om_mux_uuid;     ///< Soft-link to mux
   LIST_HEAD(,epggrab_ota_map)        om_modules;      ///< List of linked mods
   
+  int                                om_done;         ///< The full completion mark for this round
   int                                om_complete;     ///< Has completed a scan
   int                                om_save;         ///< something changed
   gtimer_t                           om_timer;        ///< Per mux active timer
index 825976cd8b7d6082d0fb23467aa976087e35f638..e6ff17b4a067910372b3f3c8b1ad65401792f505 100644 (file)
@@ -107,6 +107,7 @@ epggrab_ota_requeue ( void )
    * enqueue all muxes, but ommit the delayed ones (active+pending)
    */
   RB_FOREACH(om, &epggrab_ota_all, om_global_link) {
+    om->om_done = 0;
     if (om->om_q_type != EPGGRAB_OTA_MUX_IDLE)
       continue;
     TAILQ_INSERT_TAIL(&epggrab_ota_pending, om, om_q_link);
@@ -156,8 +157,11 @@ epggrab_ota_done ( epggrab_ota_mux_t *om, int reason )
   TAILQ_REMOVE(&epggrab_ota_active, om, om_q_link);
   om->om_q_type = EPGGRAB_OTA_MUX_IDLE;
   if (reason == EPGGRAB_OTA_DONE_STOLEN) {
-    TAILQ_INSERT_HEAD(&epggrab_ota_pending, om, om_q_link);
-    om->om_q_type = EPGGRAB_OTA_MUX_PENDING;
+    /* Do not requeue completed muxes */
+    if (!om->om_done) {
+      TAILQ_INSERT_HEAD(&epggrab_ota_pending, om, om_q_link);
+      om->om_q_type = EPGGRAB_OTA_MUX_PENDING;
+    }
   } else if (reason == EPGGRAB_OTA_DONE_TIMEOUT) {
     LIST_FOREACH(map, &om->om_modules, om_link)
       if (!map->om_complete)
@@ -173,8 +177,9 @@ epggrab_ota_done ( epggrab_ota_mux_t *om, int reason )
 }
 
 static void
-epggrab_ota_complete_mark ( epggrab_ota_mux_t *om )
+epggrab_ota_complete_mark ( epggrab_ota_mux_t *om, int done )
 {
+  om->om_done = 1;
   if (!om->om_complete) {
     om->om_complete = 1;
     epggrab_ota_save(om);
@@ -323,8 +328,6 @@ epggrab_ota_complete
   lock_assert(&global_lock);
   tvhdebug(mod->id, "grab complete");
 
-  epggrab_ota_complete_mark(ota);
-
   /* Test for completion */
   LIST_FOREACH(map, &ota->om_modules, om_link) {
     if (map->om_module == mod) {
@@ -335,6 +338,9 @@ epggrab_ota_complete
     tvhtrace("epggrab", "%s complete %i first %i",
                         map->om_module->id, map->om_complete, map->om_first);
   }
+
+  epggrab_ota_complete_mark(ota, done);
+
   if (!done) return;
 
   /* Done */
@@ -364,7 +370,7 @@ epggrab_ota_timeout_cb ( void *p )
   epggrab_ota_done(om, EPGGRAB_OTA_DONE_TIMEOUT);
   /* Not completed, but no further data for a long period */
   /* wait for a manual mux tuning */
-  epggrab_ota_complete_mark(om);
+  epggrab_ota_complete_mark(om, 1);
 }
 
 static void
@@ -388,7 +394,7 @@ epggrab_ota_data_timeout_cb ( void *p )
     /* Abort */
     epggrab_ota_done(om, EPGGRAB_OTA_DONE_NO_DATA);
     /* Not completed, but no data - wait for a manual mux tuning */
-    epggrab_ota_complete_mark(om);
+    epggrab_ota_complete_mark(om, 1);
   }
 }