Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
profile: add 'continue on access error', fix 'force priority'
  • Loading branch information
perexg committed Apr 29, 2015
1 parent ed3a02e commit 09265f0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
10 changes: 9 additions & 1 deletion src/profile.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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),
Expand All @@ -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,
},
{ }
}
};
Expand Down
1 change: 1 addition & 0 deletions src/profile.h
Expand Up @@ -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);
Expand Down
28 changes: 19 additions & 9 deletions src/subscriptions.c
Expand Up @@ -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;
}

Expand All @@ -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 */
Expand Down Expand Up @@ -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);

Expand Down
15 changes: 8 additions & 7 deletions src/subscriptions.h
Expand Up @@ -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
Expand Down

1 comment on commit 09265f0

@stan86
Copy link

@stan86 stan86 commented on 09265f0 May 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a typo in subscription.h
#define SUBSCRIPTION_ONESHOT 0x090
should be

define SUBSCRIPTION_ONESHOT 0x080

Please sign in to comment.