[Asterisk-code-review] res pjsip pubsub: Add more locking and checking around termi... (asterisk[13])
Richard Mudgett
asteriskteam at digium.com
Mon Jun 13 12:09:29 CDT 2016
Richard Mudgett has posted comments on this change.
Change subject: res_pjsip_pubsub: Add more locking and checking around terminates
......................................................................
Patch Set 2: Code-Review-1
(3 comments)
https://gerrit.asterisk.org/#/c/3018/2/res/res_pjsip_pubsub.c
File res/res_pjsip_pubsub.c:
Line 2332: if (sub->tree->last_notify) {
You are mixing the usage of last_notify. It was originally used as a boolean to indicate that the last notify has been sent. Now you are also using it as a count of how many subscription terminations are pending.
Line 3341: if (!(sub_tree->evsub && sub_tree->dlg)) {
This is an awkward expression. Why not distribute the ! operator and reduce the parentheses?
if (!sub_tree->evsub || !sub_tree->dlg)
You have done this in many places.
Line 3455: if (!(sub_tree->evsub && sub_tree->dlg)) {
There is no need to avoid caching sub_tree->dlg in a local variable.
The sub_tree->dlg pointer cannot ever go NULL on you as the dialog pointer is only NULLed when the sub_tree object is destroyed by its destructor.
It looks like you don't think you have a valid ref to sub_tree in many places even though that pointer is passed into the routine. If you don't have a ref then that is the problem and not that the dlg pointer can go NULL on you.
--
To view, visit https://gerrit.asterisk.org/3018
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I779d11802cf672a51392e62a74a1216596075ba1
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list