mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 22:54:18 +00:00
Added signalling state handle for boost modules
This commit is contained in:
1 parent
28484a15e9
commit
78fbece886
4 files changed
+33
-11
No files matched your search
@@ -2119,6 +2119,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_boost_destroy)
|
||||
static ftdm_status_t ftdm_sangoma_boost_start(ftdm_span_t *span)
|
||||
{
|
||||
int err;
|
||||
|
||||
ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
|
||||
ftdm_set_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING);
|
||||
err=ftdm_thread_create_detached(ftdm_sangoma_boost_run, span);
|
||||
@@ -2137,23 +2138,23 @@ static ftdm_status_t ftdm_sangoma_boost_start(ftdm_span_t *span)
|
||||
|
||||
static ftdm_status_t ftdm_sangoma_boost_stop(ftdm_span_t *span)
|
||||
{
|
||||
int cnt = 10;
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
|
||||
if (sangoma_boost_data->sigmod) {
|
||||
|
||||
/* FIXME: we should make sure the span thread is stopped (use pthread_kill or freetdm thread kill function) */
|
||||
/* I think stopping the span before destroying the queue makes sense
|
||||
otherwise may be boost events would still arrive when the queue is already destroyed! */
|
||||
status = sangoma_boost_data->sigmod->stop_span(span);
|
||||
|
||||
ftdm_queue_enqueue(sangoma_boost_data->boost_queue, NULL);
|
||||
}
|
||||
|
||||
while (ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING)) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n");
|
||||
ftdm_sleep(100);
|
||||
}
|
||||
|
||||
if (sangoma_boost_data->sigmod) {
|
||||
while(ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING) && cnt-- > 0) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n");
|
||||
ftdm_sleep(500);
|
||||
}
|
||||
ftdm_queue_destroy(&sangoma_boost_data->boost_queue);
|
||||
return status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user