<p>Corey Farrell <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/7710">View Change</a></p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p style="white-space: pre-wrap; word-wrap: break-word;">I don't know enough about pjsip to review this for correct handling of OPTIONS, so this is just a generic review.</p><p>(10 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_configuration.c">File res/res_pjsip/pjsip_configuration.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_configuration.c@1140">Patch Set #1, Line 1140:</a> <code style="font-family:monospace,monospace"> return 0;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">return blob ? 0 : -1;</p></li></ul></li><li><p><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c">File res/res_pjsip/pjsip_options.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@470">Patch Set #1, Line 470:</a> <code style="font-family:monospace,monospace">static void sip_options_aor_destroy(void *obj)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Nit: could you move this just before sip_options_aor_alloc?  Keeping them together makes it easier to compare now and in the future.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@475">Patch Set #1, Line 475:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">        ao2_callback(aor_options->permanent_contacts, OBJ_NODATA | OBJ_UNLINK, sip_options_remove_contact, aor_options);<br>   ao2_callback(aor_options->dynamic_contacts, OBJ_NODATA | OBJ_UNLINK, sip_options_remove_contact, aor_options);<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Need to NULL check each of these containers.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@652">Patch Set #1, Line 652:</a> <code style="font-family:monospace,monospace">                      ast_sip_persistent_endpoint_publish_contact_state(endpoint_state_compositor->name, contact_status);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Extra indentation.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@850">Patch Set #1, Line 850:</a> <code style="font-family:monospace,monospace">               return 0;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Leaks endpoint.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@874">Patch Set #1, Line 874:</a> <code style="font-family:monospace,monospace">       if (ast_sip_send_out_of_dialog_request(tdata, endpoint, (int)(aor_options->qualify_timeout * 1000), contact_callback_data, qualify_contact_cb) != PJ_SUCCESS) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">It doesn't look like ast_sip_send_out_of_dialog_request steals a reference to endpoint even in success.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@1055">Patch Set #1, Line 1055:</a> <code style="font-family:monospace,monospace">        existing_permanent_contacts = ao2_container_clone(aor_options->permanent_contacts, 0);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">It seems like this could be expensive?  It can be optimized away if (!aor->permanent_contacts), in that case you can just OBJ_UNLINK and run sip_options_remove_contact directly on aor_options->permanent_contacts.</p><p style="white-space: pre-wrap; word-wrap: break-word;">In addition for the if (aor->permanent_contacts) branch should we lock aor_options->permanent_contacts before the clone and unlock after we are done relinking contacts?</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@1165">Patch Set #1, Line 1165:</a> <code style="font-family:monospace,monospace">         AST_VECTOR_GET(&task_data->aor_options->compositors, i);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Indent</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@1278">Patch Set #1, Line 1278:</a> <code style="font-family:monospace,monospace">     AST_VECTOR_APPEND(&task_data->aor_options->compositors, ao2_bump(task_data->endpoint_state_compositor));</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">aor_options->compositors is safe to modify without a lock?</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/7710/1/res/res_pjsip/pjsip_options.c@1283">Patch Set #1, Line 1283:</a> <code style="font-family:monospace,monospace">           task_data->endpoint_state_compositor->available++;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">No debug for this manipulation of available?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/7710">change 7710</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/7710"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I6a5ebbfca9001dfe933eaeac4d3babd8d2e6f082 </div>
<div style="display:none"> Gerrit-Change-Number: 7710 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@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>
<div style="display:none"> Gerrit-Comment-Date: Tue, 26 Dec 2017 07:05:24 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>