<p style="white-space: pre-wrap; word-wrap: break-word;">This is an initial review, still working on it.</p><p>Patch set 4:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/10882">View Change</a></p><p>9 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c">File res/res_stasis.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1333">Patch Set #4, Line 1333:</a> <code style="font-family:monospace,monospace">         if (control_next_app(control)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Document here that control_next_app is only modified within the control thread</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1339">Patch Set #4, Line 1339:</a> <code style="font-family:monospace,monospace">                 if (app && app_is_active(app)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">what happens if app is not found or app is not active? what's the behavior for the channel?</p><p style="white-space: pre-wrap; word-wrap: break-word;">app used to point to the previous app, now it does not (leaking a reference)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1354">Patch Set #4, Line 1354:</a> <code style="font-family:monospace,monospace">                         /* We bumped this when trying to find it, so we need to decrement */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I think this reference counting needs to be better documented/defined. You need to drop it twice because 'app' had a reference to it which you kind of inherited/lost.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1357">Patch Set #4, Line 1357:</a> <code style="font-family:monospace,monospace">                             cleanup();</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">It should be documented why you call this</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1359">Patch Set #4, Line 1359:</a> <code style="font-family:monospace,monospace">                            ao2_cleanup(last_app);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">It's guaranteed last_app will always be non-NULL so ao2_ref can be used</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1399">Patch Set #4, Line 1399:</a> <code style="font-family:monospace,monospace">                              app_unsubscribe_bridge(control_app(control), last_bridge);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Should the few calls at the beginning of this function also move to using control_app?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/res_stasis.c@1498">Patch Set #4, Line 1498:</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_cleanup(control_app(control));<br>    app = NULL;<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I don't think app is actually necessary here for reasons previously mentioned in this review.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10882/4/res/stasis/app.c">File res/stasis/app.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/stasis/app.c@1029">Patch Set #4, Line 1029:</a> <code style="font-family:monospace,monospace">                      ast_log(LOG_WARNING, "Could not find or create context '%s'\n", context_name);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I'd extend this warning to include details about the application too</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10882/4/res/stasis/control.c">File res/stasis/control.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10882/4/res/stasis/control.c@1401">Patch Set #4, Line 1401:</a> <code style="font-family:monospace,monospace">  control->app = ao2_bump(app);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">What if there's an existing app here?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10882">change 10882</a>. To unsubscribe, or for help writing mail filters, 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/10882"/><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: Ib6c569468472dbb08905b356887373c81e03015d </div>
<div style="display:none"> Gerrit-Change-Number: 10882 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 21 Jan 2019 14:36:24 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>