[Asterisk-code-review] cdr.c: Eliminated many calls to ao2 global obj ref(). (asterisk[master])

Corey Farrell asteriskteam at digium.com
Thu Oct 12 14:34:35 CDT 2017


Corey Farrell has posted comments on this change. ( https://gerrit.asterisk.org/6785 )

Change subject: cdr.c: Eliminated many calls to ao2_global_obj_ref().
......................................................................


Patch Set 1: Code-Review-1

(5 comments)

https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c
File main/cdr.c:

https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c@1102
PS1, Line 1102: 	if (ast_test_flag(&mod_cfg->general->settings, CDR_INITIATED_SECONDS)
I think this should use is_cdr_flag_set. That way it would return `ms / 1000` if we don't have a config object instead of returning 0.


https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c@2688
PS1, Line 2688: 	ao2_cleanup(mod_cfg->general);
Nit: this could use ao2_replace instead.  Feel free to ignore this since you're not already modifying these 3 lines, it would just make it easier to read.

This function doesn't seem thread safe but it's only used by a test so I guess no big deal?


https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c@2708
PS1, Line 2708: 	is_enabled = ast_test_flag(&mod_cfg->general->settings, CDR_ENABLED);
Once we have is_cdr_flag_set it should be used here instead of duplicating the logic.


https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c@4303
PS1, Line 4303: 		return -1;
Do we not want to treat this situation as if CDR is disabled and call destroy_subscriptions?


https://gerrit.asterisk.org/#/c/6785/1/main/cdr.c@4424
PS1, Line 4424: 	if (!mod_cfg) {
It seems like we should treat this as if cdr is disabled.  We've already confirmed that old_mod_cfg != NULL so we should finalize_batch_mode if appropriate and still call cdr_toggle_runtime_options.



-- 
To view, visit https://gerrit.asterisk.org/6785
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iceaad93172862f610cad0188956634187bfcc7cd
Gerrit-Change-Number: 6785
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Comment-Date: Thu, 12 Oct 2017 19:34:35 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171012/1bbfd26c/attachment.html>


More information about the asterisk-code-review mailing list