<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6751">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cdr.c: Defer misc checks.<br><br>Try to defer some checks until needed in case there is an early exit.<br><br>Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064<br>---<br>M main/cdr.c<br>1 file changed, 11 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/51/6751/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/cdr.c b/main/cdr.c<br>index ddbed5f..06cadcd 100644<br>--- a/main/cdr.c<br>+++ b/main/cdr.c<br>@@ -1938,6 +1938,10 @@<br> if (!peer && !caller) {<br> return;<br> }<br>+ if (filter_channel_snapshot(peer) || (caller && filter_channel_snapshot(caller))) {<br>+ return;<br>+ }<br>+<br> dial_status_blob = ast_json_object_get(ast_multi_channel_blob_get_json(payload), "dialstatus");<br> if (dial_status_blob) {<br> dial_status = ast_json_string_get(dial_status_blob);<br>@@ -1949,10 +1953,6 @@<br> peer ? peer->name : "(none)",<br> (unsigned int)stasis_message_timestamp(message)->tv_sec,<br> (unsigned int)stasis_message_timestamp(message)->tv_usec);<br>-<br>- if (filter_channel_snapshot(peer) || (caller && filter_channel_snapshot(caller))) {<br>- return;<br>- }<br> <br> /* Figure out who is running this show */<br> if (caller) {<br>@@ -2083,8 +2083,6 @@<br> struct stasis_cache_update *update = stasis_message_data(message);<br> struct ast_channel_snapshot *old_snapshot;<br> struct ast_channel_snapshot *new_snapshot;<br>- const char *uniqueid;<br>- const char *name;<br> struct cdr_object *it_cdr;<br> <br> ast_assert(update != NULL);<br>@@ -2092,8 +2090,6 @@<br> <br> old_snapshot = stasis_message_data(update->old_snapshot);<br> new_snapshot = stasis_message_data(update->new_snapshot);<br>- uniqueid = new_snapshot ? new_snapshot->uniqueid : old_snapshot->uniqueid;<br>- name = new_snapshot ? new_snapshot->name : old_snapshot->name;<br> <br> if (filter_channel_cache_message(old_snapshot, new_snapshot)) {<br> return;<br>@@ -2107,11 +2103,17 @@<br> cdr->is_root = 1;<br> ao2_link(active_cdrs_by_channel, cdr);<br> } else {<br>+ const char *uniqueid;<br>+<br>+ uniqueid = new_snapshot ? new_snapshot->uniqueid : old_snapshot->uniqueid;<br> cdr = ao2_find(active_cdrs_by_channel, uniqueid, OBJ_SEARCH_KEY);<br> }<br> <br> /* Handle Party A */<br> if (!cdr) {<br>+ const char *name;<br>+<br>+ name = new_snapshot ? new_snapshot->name : old_snapshot->name;<br> ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", name);<br> ast_assert(0);<br> } else {<br>@@ -4321,7 +4323,7 @@<br> RAII_VAR(struct module_config *, old_mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);<br> RAII_VAR(struct module_config *, mod_cfg, NULL, ao2_cleanup);<br> <br>- if (process_config(1)) {<br>+ if (!old_mod_cfg || process_config(1)) {<br> return -1;<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6751">change 6751</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/6751"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064 </div>
<div style="display:none"> Gerrit-Change-Number: 6751 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>