if (flags & SUBSCRIPTION_SWSERVICE) {
for (next = TAILQ_NEXT(si, si_link); next;
next = TAILQ_NEXT(next, si_link))
- if (si->si_s == next->si_s)
+ if (si->si_s == next->si_s && si->si_error)
next->si_error = si->si_error;
}
}
t->s_streaming_status = set;
- tvhdebug(LS_SERVICE, "%s: Status changed to %s%s%s%s%s%s%s%s%s",
+ tvhdebug(LS_SERVICE, "%s: Status changed to %s%s%s%s%s%s%s%s%s%s",
service_nicename(t),
set & TSS_INPUT_HARDWARE ? "[Hardware input] " : "",
set & TSS_INPUT_SERVICE ? "[Input on service] " : "",
set & TSS_PACKETS ? "[Reassembled packets] " : "",
set & TSS_NO_DESCRAMBLER ? "[No available descrambler] " : "",
set & TSS_NO_ACCESS ? "[No access] " : "",
+ set & TSS_CA_CHECK ? "[CA check] " : "",
set & TSS_TUNING ? "[Tuning failed] " : "",
set & TSS_GRACEPERIOD ? "[Graceperiod expired] " : "",
set & TSS_TIMEOUT ? "[Data timeout] " : "");
subscription_reschedule();
}
+/**
+ *
+ */
+static void
+subscription_ca_check_cb(void *aux)
+{
+ th_subscription_t *s = aux;
+ service_t *t = s->ths_service;
+ int flags = 0;
+
+ if (t == NULL)
+ return;
+
+ pthread_mutex_lock(&t->s_stream_mutex);
+
+ if(t->s_streaming_status & TSS_NO_ACCESS)
+ flags |= TSS_CA_CHECK;
+ if (flags)
+ service_set_streaming_status_flags(t, flags);
+
+ pthread_mutex_unlock(&t->s_stream_mutex);
+}
+
/**
*
*/
s->ths_flags, s->ths_timeout,
mclk() > s->ths_postpone_end ?
0 : mono2sec(s->ths_postpone_end - mclk()));
- if (si)
- s->ths_service_start = mclk();
+ if (si && (s->ths_flags & SUBSCRIPTION_CONTACCESS))
+ mtimer_arm_rel(&s->ths_ca_check_timer, subscription_ca_check_cb, s, s->ths_ca_timeout);
return s->ths_current_instance = si;
}
static void
subscription_input(void *opaque, streaming_message_t *sm)
{
- int error, mask2 = 0;
+ int error;
th_subscription_t *s = opaque;
- /* handle NO_ACCESS condition with some delay */
- if(sm->sm_code & TSS_NO_ACCESS &&
- s->ths_service_start + s->ths_ca_timeout < mclk())
- mask2 |= TSS_NO_ACCESS;
-
if(subgetstate(s) == SUBSCRIPTION_TESTING_SERVICE) {
// We are just testing if this service is good
}
if(sm->sm_type == SMT_SERVICE_STATUS &&
- (sm->sm_code & (TSS_ERRORS|mask2))) {
+ (sm->sm_code & (TSS_ERRORS|TSS_CA_CHECK))) {
// No, mark our subscription as bad_service
// the scheduler will take care of things
error = tss2errcode(sm->sm_code);
- if (error != SM_CODE_NO_ACCESS ||
- (s->ths_flags & SUBSCRIPTION_CONTACCESS) == 0) {
- if (error > s->ths_testing_error)
- s->ths_testing_error = error;
- subsetstate(s, SUBSCRIPTION_BAD_SERVICE);
- streaming_msg_free(sm);
- return;
- }
- }
+ if (error != SM_CODE_OK)
+ if (error != SM_CODE_NO_ACCESS ||
+ (s->ths_flags & SUBSCRIPTION_CONTACCESS) == 0) {
+ if (error > s->ths_testing_error)
+ s->ths_testing_error = error;
+ subsetstate(s, SUBSCRIPTION_BAD_SERVICE);
+ streaming_msg_free(sm);
+ return;
+ }
+ }
if(sm->sm_type == SMT_SERVICE_STATUS &&
(sm->sm_code & TSS_PACKETS)) {
}
if (sm->sm_type == SMT_SERVICE_STATUS &&
- (sm->sm_code & (TSS_TUNING|TSS_TIMEOUT|mask2))) {
+ (sm->sm_code & (TSS_TUNING|TSS_TIMEOUT|TSS_CA_CHECK))) {
error = tss2errcode(sm->sm_code);
- 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;
- }
+ if (error != SM_CODE_OK)
+ 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 */
service_instance_list_clear(&s->ths_instances);
mtimer_disarm(&s->ths_remove_timer);
+ mtimer_disarm(&s->ths_ca_check_timer);
if ((flags & UNSUBSCRIBE_FINAL) != 0 ||
(s->ths_flags & SUBSCRIPTION_ONESHOT) != 0)