summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_pres.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-10-14 01:58:04 +0000
committerBenny Prijono <bennylp@teluu.com>2009-10-14 01:58:04 +0000
commit2dd0fe09ceb1675de340d5d4ff84251b3697b435 (patch)
tree57bbbf8f79d24d908bc2aae95d9134e3cd37d72e /pjsip/src/pjsua-lib/pjsua_pres.c
parentb2aac52d83d6e4fb46e2bef723647fa2bb1ad8be (diff)
Ticket #970: More gracefull PJSUA-LIB shutdown sequence. Enhancements:
- wait for unregistration to complete (or a preconfigured delay expires) - new account config field to set the maximum delay to wait for unregistration - rejects incoming requests (INVITE, SUBSCRIBE, and OPTIONS) when shutdown is in progress git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2943 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_pres.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_pres.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c
index 4515636c..935a41e7 100644
--- a/pjsip/src/pjsua-lib/pjsua_pres.c
+++ b/pjsip/src/pjsua-lib/pjsua_pres.c
@@ -682,6 +682,14 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata)
/* Incoming SUBSCRIBE: */
+ /* Don't want to accept the request if shutdown is in progress */
+ if (pjsua_var.thread_quit_flag) {
+ pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata,
+ PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL,
+ NULL, NULL);
+ return PJ_TRUE;
+ }
+
PJSUA_LOCK();
/* Find which account for the incoming request. */
@@ -1721,6 +1729,8 @@ void pjsua_pres_shutdown(void)
{
unsigned i;
+ PJ_LOG(4,(THIS_FILE, "Shutting down presence.."));
+
if (pjsua_var.pres_timer.id != 0) {
pjsip_endpt_cancel_timer(pjsua_var.endpt, &pjsua_var.pres_timer);
pjsua_var.pres_timer.id = PJ_FALSE;