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();
return s->ths_current_instance = si;
}
* the currently bound service
*/
static void
-subscription_input(void *opauqe, streaming_message_t *sm)
+subscription_input(void *opaque, streaming_message_t *sm)
{
- int error;
- th_subscription_t *s = opauqe;
+ int error, mask2 = 0;
+ th_subscription_t *s = opaque;
+
+ /* handle NO_ACCESS condition with some delay */
+ if(sm->sm_code & TSS_NO_ACCESS && s->ths_service_start + sec2mono(2) < 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|TSS_NO_ACCESS)) {
+ (sm->sm_code & (TSS_ERRORS|mask2))) {
// No, mark our subscription as bad_service
// the scheduler will take care of things
error = tss2errcode(sm->sm_code);
}
if(sm->sm_type == SMT_SERVICE_STATUS &&
- sm->sm_code & TSS_PACKETS) {
+ (sm->sm_code & TSS_PACKETS)) {
if(s->ths_start_message != NULL) {
streaming_target_deliver(s->ths_output, s->ths_start_message);
s->ths_start_message = NULL;
}
if (sm->sm_type == SMT_SERVICE_STATUS &&
- sm->sm_code & (TSS_TUNING|TSS_TIMEOUT|TSS_NO_ACCESS)) {
+ (sm->sm_code & (TSS_TUNING|TSS_TIMEOUT|mask2))) {
error = tss2errcode(sm->sm_code);
if (error != SM_CODE_NO_ACCESS ||
(s->ths_flags & SUBSCRIPTION_CONTACCESS) == 0) {
char *ths_title; /* display title */
time_t ths_start; /* time when subscription started */
+ int64_t ths_service_start; /* time when service started */
int ths_total_err; /* total errors during entire subscription */
uint64_t ths_total_bytes_in; /* total bytes since the subscription started */
uint64_t ths_total_bytes_out; /* total bytes since the subscription started */