[asterisk-commits] gtjoseph: trunk r430398 - in /trunk: ./ res/res_pjsip_pubsub.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 8 15:41:06 CST 2015
Author: gtjoseph
Date: Thu Jan 8 15:41:02 2015
New Revision: 430398
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430398
Log:
res_pjsip_pubsub: Fix persistent subscriptions not surviving graceful shutdown
If you do a 'core (shutdown|restart) graceful' persistent subscriptions won't
survive. If you do a 'core (shutdown|restart) now' or asterisk terminates for
some reason, they do. Here's why...
When asterisk shuts down gracefully, it sends a 'NOTIFY/terminated' to
subscribers for each subscription. This not only tells the subscribers that the
dialog/state machine is done, it also frees the last reference to the
subscription tree which causes the persistent subscription to get deleted from
astdb. When asterisk restarts, nothing's left. Just preventing the delete from
astdb doesn't work because we already told the subscriber to terminate the
dialog so we can't restart it even if it was still in astdb. Everything works
OK if asterisk terminates unexpectedly because we never send the 'terminated'
message so on restart, the subscription is still in astdb and the subscriber is
none the wiser.
This patch suppresses the sending of 'NOTIFY/terminated' on shutdown for
persistent connections.
Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4318/
........
Merged revisions 430397 from http://svn.asterisk.org/svn/asterisk/branches/13
Modified:
trunk/ (props changed)
trunk/res/res_pjsip_pubsub.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.
Modified: trunk/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_pubsub.c?view=diff&rev=430398&r1=430397&r2=430398
==============================================================================
--- trunk/res/res_pjsip_pubsub.c (original)
+++ trunk/res/res_pjsip_pubsub.c Thu Jan 8 15:41:02 2015
@@ -2060,6 +2060,12 @@
pjsip_evsub *evsub = sub_tree->evsub;
pjsip_tx_data *tdata;
+ if (ast_shutting_down()
+ && sub_tree->root->subscription_state == PJSIP_EVSUB_STATE_TERMINATED
+ && sub_tree->persistence) {
+ return 0;
+ }
+
if (pjsip_evsub_notify(evsub, sub_tree->root->subscription_state,
NULL, NULL, &tdata) != PJ_SUCCESS) {
return -1;
More information about the asterisk-commits
mailing list