]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
profile: add 'continue on access error', fix 'force priority'
authorJaroslav Kysela <perex@perex.cz>
Wed, 29 Apr 2015 14:08:22 +0000 (16:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 29 Apr 2015 14:08:22 +0000 (16:08 +0200)
src/profile.c
src/profile.h
src/subscriptions.c
src/subscriptions.h

index 870bff22473802d0a456b5582098bf1d35bd45f9..289fae2f2a147ca4064b0ecd1fbb22c3bb3e43b5 100644 (file)
@@ -98,6 +98,7 @@ profile_create
   }
   LIST_INIT(&pro->pro_dvr_configs);
   LIST_INIT(&pro->pro_accesses);
+  pro->pro_contaccess = 1;
   if (idnode_insert(&pro->pro_id, uuid, pb->clazz, 0)) {
     if (uuid)
       tvherror("profile", "invalid uuid '%s'", uuid);
@@ -313,7 +314,7 @@ const idclass_t profile_class =
       .def.i    = PROFILE_SPRIO_NORMAL
     },
     {
-      .type     = PT_BOOL,
+      .type     = PT_INT,
       .id       = "fpriority",
       .name     = "Force Priority",
       .off      = offsetof(profile_t, pro_fprio),
@@ -332,6 +333,13 @@ const idclass_t profile_class =
       .off      = offsetof(profile_t, pro_restart),
       .def.i    = 0,
     },
+    {
+      .type     = PT_BOOL,
+      .id       = "contaccess",
+      .name     = "Continue On Access Error",
+      .off      = offsetof(profile_t, pro_contaccess),
+      .def.i    = 1,
+    },
     { }
   }
 };
index b0d4270a337a0eb67641b8e80b04f57dd94bf39a..d2169be4ec34f3a7302348b41bdf60cd1fd0106a 100644 (file)
@@ -122,6 +122,7 @@ typedef struct profile {
   int pro_fprio;
   int pro_timeout;
   int pro_restart;
+  int pro_contaccess;
 
   void (*pro_free)(struct profile *pro);
   void (*pro_conf_changed)(struct profile *pro);
index 00252f0bd4255c766bd4f80e64de9c1b0d1e04a0..b44aff9b8bd06cb4593bbfcb1a26a89db002b655 100644 (file)
@@ -494,10 +494,13 @@ subscription_input(void *opauqe, streaming_message_t *sm)
       // No, mark our subscription as bad_service
       // the scheduler will take care of things
       error = tss2errcode(sm->sm_code);
-      if (error > s->ths_testing_error)
-        s->ths_testing_error = error;
-      s->ths_state = SUBSCRIPTION_BAD_SERVICE;
-      streaming_msg_free(sm);
+      if (error != SM_CODE_NO_ACCESS ||
+          (s->ths_flags & SUBSCRIPTION_CONTACCESS) == 0) {
+        if (error > s->ths_testing_error)
+          s->ths_testing_error = error;
+        s->ths_state = SUBSCRIPTION_BAD_SERVICE;
+        streaming_msg_free(sm);
+      }
       return;
     }
 
@@ -521,9 +524,12 @@ subscription_input(void *opauqe, streaming_message_t *sm)
   if (sm->sm_type == SMT_SERVICE_STATUS &&
       sm->sm_code & (TSS_TUNING|TSS_TIMEOUT)) {
     error = tss2errcode(sm->sm_code);
-    if (error > s->ths_testing_error)
-      s->ths_testing_error = error;
-    s->ths_state = SUBSCRIPTION_BAD_SERVICE;
+    if (error != SM_CODE_NO_ACCESS ||
+        (s->ths_flags & SUBSCRIPTION_CONTACCESS) == 0) {
+      if (error > s->ths_testing_error)
+        s->ths_testing_error = error;
+      s->ths_state = SUBSCRIPTION_BAD_SERVICE;
+    }
   }
 
   /* Pass to direct handler to log traffic */
@@ -660,8 +666,12 @@ subscription_create
   else
     s->ths_weight = weight;
 
-  if (pro && pro->pro_restart)
-    s->ths_flags |= SUBSCRIPTION_RESTART;
+  if (pro) {
+    if (pro->pro_restart)
+      s->ths_flags |= SUBSCRIPTION_RESTART;
+    if (pro->pro_contaccess)
+      s->ths_flags |= SUBSCRIPTION_CONTACCESS;
+  }
 
   time(&s->ths_start);
 
index c2ad74dca1a80f26eafd0ae02602eccdaa328a7e..a866372c51fb6a0488f1034a1ef214604c7e0c44 100644 (file)
@@ -31,13 +31,14 @@ extern struct th_subscription_list subscriptions;
 #define SUBSCRIPTION_TYPE_MASK  0x00f
 #define SUBSCRIPTION_STREAMING  0x010
 #define SUBSCRIPTION_RESTART    0x020
-#define SUBSCRIPTION_ONESHOT    0x040
-#define SUBSCRIPTION_TABLES     0x080
-#define SUBSCRIPTION_INITSCAN   0x100 ///< for mux subscriptions
-#define SUBSCRIPTION_IDLESCAN   0x200 ///< for mux subscriptions
-#define SUBSCRIPTION_USERSCAN   0x400 ///< for mux subscriptions
-#define SUBSCRIPTION_EPG        0x800 ///< for mux subscriptions
-#define SUBSCRIPTION_MINIMAL   0x1000
+#define SUBSCRIPTION_CONTACCESS 0x040
+#define SUBSCRIPTION_ONESHOT    0x090
+#define SUBSCRIPTION_TABLES     0x100
+#define SUBSCRIPTION_MINIMAL    0x200
+#define SUBSCRIPTION_INITSCAN  0x1000 ///< for mux subscriptions
+#define SUBSCRIPTION_IDLESCAN  0x2000 ///< for mux subscriptions
+#define SUBSCRIPTION_USERSCAN  0x4000 ///< for mux subscriptions
+#define SUBSCRIPTION_EPG       0x8000 ///< for mux subscriptions
 
 /* Some internal priorities */
 #define SUBSCRIPTION_PRIO_KEEP        1 ///< Keep input rolling