summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index d12951c45..82bd7c98b 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3636,11 +3636,7 @@ int ast_sip_push_task(struct ast_taskprocessor *serializer, int (*sip_task)(void
serializer = serializer_pool[pos];
}
- if (serializer) {
- return ast_taskprocessor_push(serializer, sip_task, task_data);
- } else {
- return ast_threadpool_push(sip_threadpool, sip_task, task_data);
- }
+ return ast_taskprocessor_push(serializer, sip_task, task_data);
}
struct sync_task_data {
@@ -4158,6 +4154,11 @@ static int load_module(void)
goto error;
}
+ if (ast_sip_initialize_scheduler()) {
+ ast_log(LOG_ERROR, "Failed to start scheduler. Aborting load\n");
+ goto error;
+ }
+
/* Now load all the pjproject infrastructure. */
if (load_pjsip()) {
goto error;
@@ -4196,8 +4197,10 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
error:
- /* These functions all check for NULLs and are safe to call at any time */
unload_pjsip(NULL);
+
+ /* These functions all check for NULLs and are safe to call at any time */
+ ast_sip_destroy_scheduler();
serializer_pool_shutdown();
ast_threadpool_shutdown(sip_threadpool);
@@ -4228,7 +4231,7 @@ static int unload_module(void)
* so we have to push the work to the threadpool to handle
*/
ast_sip_push_task_synchronous(NULL, unload_pjsip, NULL);
-
+ ast_sip_destroy_scheduler();
serializer_pool_shutdown();
ast_threadpool_shutdown(sip_threadpool);