<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8892">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip/pjsip_distributor.c: Pull some assignments out of if tests.<br><br>Change-Id: I3d30d638b53a4bbe9bf9aad853c649d583894112<br>---<br>M res/res_pjsip/pjsip_distributor.c<br>1 file changed, 16 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c<br>index 33d4bce..68a0cbc 100644<br>--- a/res/res_pjsip/pjsip_distributor.c<br>+++ b/res/res_pjsip/pjsip_distributor.c<br>@@ -690,7 +690,8 @@<br> * the find without OBJ_UNLINK to prevent the unnecessary write lock, then unlink<br> * if needed.<br> */<br>- if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY))) {<br>+ unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);<br>+ if (unid) {<br> ao2_unlink(unidentified_requests, unid);<br> ao2_ref(unid, -1);<br> }<br>@@ -699,14 +700,14 @@<br> <br> endpoint = ast_sip_identify_endpoint(rdata);<br> if (endpoint) {<br>- if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY))) {<br>+ unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);<br>+ if (unid) {<br> ao2_unlink(unidentified_requests, unid);<br> ao2_ref(unid, -1);<br> }<br> }<br> <br> if (!endpoint) {<br>-<br> /* always use an artificial endpoint - per discussion no reason<br> to have "alwaysauthreject" as an option. It is felt using it<br> was a bug fix and it is not needed since we are not worried about<br>@@ -715,9 +716,10 @@<br> endpoint = ast_sip_get_artificial_endpoint();<br> }<br> <br>+ /* endpoint ref held by mod_data[] */<br> rdata->endpt_info.mod_data[endpoint_mod.id] = endpoint;<br> <br>- if ((endpoint == artificial_endpoint) && !is_ack) {<br>+ if (endpoint == artificial_endpoint && !is_ack) {<br> char name[AST_UUID_STR_LEN] = "";<br> pjsip_uri *from = rdata->msg_info.from->uri;<br> <br>@@ -726,17 +728,20 @@<br> ast_copy_pj_str(name, &sip_from->user, sizeof(name));<br> }<br> <br>- if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY))) {<br>+ unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);<br>+ if (unid) {<br> check_endpoint(rdata, unid, name);<br> ao2_ref(unid, -1);<br> } else if (using_auth_username) {<br> ao2_wrlock(unidentified_requests);<br>- /* The check again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */<br>- if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY | OBJ_NOLOCK))) {<br>+ /* Checking again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */<br>+ unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name,<br>+ OBJ_SEARCH_KEY | OBJ_NOLOCK);<br>+ if (unid) {<br> check_endpoint(rdata, unid, name);<br> } else {<br>- unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1, NULL,<br>- AO2_ALLOC_OPT_LOCK_RWLOCK);<br>+ unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1,<br>+ NULL, AO2_ALLOC_OPT_LOCK_RWLOCK);<br> if (!unid) {<br> ao2_unlock(unidentified_requests);<br> return PJ_TRUE;<br>@@ -860,7 +865,8 @@<br> return PJ_TRUE;<br> case AST_SIP_AUTHENTICATION_SUCCESS:<br> /* See note in endpoint_lookup about not holding an unnecessary write lock */<br>- if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY))) {<br>+ unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);<br>+ if (unid) {<br> ao2_unlink(unidentified_requests, unid);<br> ao2_ref(unid, -1);<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8892">change 8892</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8892"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3d30d638b53a4bbe9bf9aad853c649d583894112 </div>
<div style="display:none"> Gerrit-Change-Number: 8892 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>