[Asterisk-code-review] res_pjsip_refer: Refactor progress locking and serialization (asterisk[16])

Richard Mudgett asteriskteam at digium.com
Wed Feb 24 09:55:54 CST 2021


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15494 )

Change subject: res_pjsip_refer: Refactor progress locking and serialization
......................................................................


Patch Set 3: Code-Review-1

(2 comments)

https://gerrit.asterisk.org/c/asterisk/+/15494/3/res/res_pjsip_refer.c 
File res/res_pjsip_refer.c:

https://gerrit.asterisk.org/c/asterisk/+/15494/3/res/res_pjsip_refer.c@164 
PS3, Line 164: 		/* This is for dropping the reference on the subscription */
I had initially commented about moving this comment to where the ao2_cleanup was moved.  I removed it in favor of the other comment I did put about locking.  So I am resurrecting the initial comment.

Though, I'm not seeing a need to move the ao2_cleanup anyway.  We are getting rid of the ref that is held by the pjsip_evsub_set_mod_data() pointer.  Does this routine not have its own ref to progress in the notification object?

Could call the helper_routine() function described in the other comment here.


https://gerrit.asterisk.org/c/asterisk/+/15494/3/res/res_pjsip_refer.c@346 
PS3, Line 346: 	progress->sub = NULL;
             : 
             : 		ast_debug(3, "Subscription '%p' removed from progress monitor '%p'\n", sub, progress);
             : 
             : 		if (pjsip_evsub_get_mod_data(sub, refer_progress_module.id)) {
             : 			pjsip_evsub_set_mod_data(sub, refer_progress_module.id, NULL);
             : 			ao2_cleanup(progress);
             : 		}
My previous comment about no longer needing to test if the pjsip_evsub_get_mod_data() is still valid.  There is no need to test, just do because we are holding the dialog lock just like in refer_progress_notify().

It appears that the indicated code could be put into a helper routine that is called by refere_progress_notify() too.

helper_routine(progress)
{
  progress->sub = NULL
  pjsip_evsub_set_mod_data(progress->sub, refer_progress_module.id, NULL)

  /* Remove the ref held by the evsub mod data pointer */
  ao2_cleanup(progress)
}



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15494
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I97a8bb01771a3c85345649b8124507f7622a8480
Gerrit-Change-Number: 15494
Gerrit-PatchSet: 3
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 24 Feb 2021 15:55:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210224/7d9e88ab/attachment.html>


More information about the asterisk-code-review mailing list