Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
service: another STOP/START msg cleanup
  • Loading branch information
perexg committed Nov 23, 2014
1 parent 3ba0ae6 commit 085fd89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/service.c
Expand Up @@ -1159,7 +1159,8 @@ service_restart(service_t *t)

pthread_mutex_lock(&t->s_stream_mutex);

had_components = TAILQ_FIRST(&t->s_filt_components) != NULL;
had_components = TAILQ_FIRST(&t->s_filt_components) != NULL &&
t->s_running;

service_build_filter(t);

Expand All @@ -1172,10 +1173,12 @@ service_restart(service_t *t)
streaming_pad_deliver(&t->s_streaming_pad,
streaming_msg_create_data(SMT_START,
service_build_stream_start(t)));
t->s_running = 1;
} else {
streaming_pad_deliver(&t->s_streaming_pad,
streaming_msg_create_code(SMT_STOP,
SM_CODE_NO_SERVICE));
t->s_running = 0;
}

pthread_mutex_unlock(&t->s_stream_mutex);
Expand Down
1 change: 1 addition & 0 deletions src/service.h
Expand Up @@ -411,6 +411,7 @@ typedef struct service {
*
*/
int s_streaming_live;
int s_running;

// Live status
#define TSS_LIVE 0x01
Expand Down
4 changes: 4 additions & 0 deletions src/subscriptions.c
Expand Up @@ -100,6 +100,7 @@ subscription_link_service(th_subscription_t *s, service_t *t)
// Send a START message to the subscription client
streaming_target_deliver(s->ths_output, s->ths_start_message);
s->ths_start_message = NULL;
t->s_running = 1;

// Send status report
sm = streaming_msg_create_code(SMT_SERVICE_STATUS,
Expand Down Expand Up @@ -134,6 +135,7 @@ subscription_unlink_service0(th_subscription_t *s, int reason, int stop)
// Send a STOP message to the subscription client
sm = streaming_msg_create_code(SMT_STOP, reason);
streaming_target_deliver(s->ths_output, sm);
t->s_running = 0;
}

pthread_mutex_unlock(&t->s_stream_mutex);
Expand Down Expand Up @@ -480,6 +482,8 @@ subscription_input(void *opauqe, streaming_message_t *sm)
if(s->ths_start_message != NULL) {
streaming_target_deliver(s->ths_output, s->ths_start_message);
s->ths_start_message = NULL;
if (s->ths_service)
s->ths_service->s_running = 1;
}
s->ths_state = SUBSCRIPTION_GOT_SERVICE;
}
Expand Down

0 comments on commit 085fd89

Please sign in to comment.