mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-04 20:25:29 +00:00
Merge "res_pjsip_transport_management: Allow unload to occur." into 13
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include "asterisk.h"
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <pjsip.h>
|
#include <pjsip.h>
|
||||||
#include <pjsip_ua.h>
|
#include <pjsip_ua.h>
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ static void *keepalive_transport_thread(void *data)
|
|||||||
/* Once loaded this module just keeps on going as it is unsafe to stop and change the underlying
|
/* Once loaded this module just keeps on going as it is unsafe to stop and change the underlying
|
||||||
* callback for the transport manager.
|
* callback for the transport manager.
|
||||||
*/
|
*/
|
||||||
while (1) {
|
while (keepalive_interval) {
|
||||||
sleep(keepalive_interval);
|
sleep(keepalive_interval);
|
||||||
ao2_callback(transports, OBJ_NODATA, keepalive_transport_cb, NULL);
|
ao2_callback(transports, OBJ_NODATA, keepalive_transport_cb, NULL);
|
||||||
}
|
}
|
||||||
@@ -347,7 +349,19 @@ static int load_module(void)
|
|||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
{
|
{
|
||||||
/* This will never get called */
|
pjsip_tpmgr *tpmgr = pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint());
|
||||||
|
|
||||||
|
if (keepalive_interval) {
|
||||||
|
keepalive_interval = 0;
|
||||||
|
pthread_kill(keepalive_thread, SIGURG);
|
||||||
|
pthread_join(keepalive_thread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ast_sched_context_destroy(sched);
|
||||||
|
ao2_ref(transports, -1);
|
||||||
|
|
||||||
|
ast_sip_unregister_service(&idle_monitor_module);
|
||||||
|
pjsip_tpmgr_set_state_cb(tpmgr, tpmgr_state_callback);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user