]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: delete scheduled notification on RLS update
authorAlexei Gradinari <alex2grad@gmail.com>
Mon, 6 Jun 2022 22:21:24 +0000 (18:21 -0400)
committerJoshua Colp <jcolp@sangoma.com>
Thu, 9 Jun 2022 08:48:19 +0000 (03:48 -0500)
If there is scheduled notification, we must delete it
to avoid using destroyed subscriptions.

ASTERISK-29906

Change-Id: I1c644e5e15a8fe43eed8e4f9112f113cbf87a40f

res/res_pjsip_pubsub.c

index a0fe2736be515f683944f309139c01444d18ce13..d0f3717dbded9c60cfb1bc9d3a60a75ed4c0b32b 100644 (file)
@@ -4061,6 +4061,12 @@ static void pubsub_on_rx_refresh(pjsip_evsub *evsub, pjsip_rx_data *rdata,
                                                new_root->version = old_root->version;
                                                sub_tree->root = new_root;
                                                sub_tree->generate_initial_notify = 1;
+
+                                               /* If there is scheduled notification need to delete it to avoid use old subscriptions */
+                                               if (sub_tree->notify_sched_id > -1) {
+                                                       AST_SCHED_DEL_UNREF(sched, sub_tree->notify_sched_id, ao2_ref(sub_tree, -1));
+                                                       sub_tree->send_scheduled_notify = 0;
+                                               }
                                                shutdown_subscriptions(old_root);
                                                destroy_subscriptions(old_root);
                                        } else {