[Asterisk-code-review] cdr mysql: run a full reconnect on log if not connected (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Tue May 8 13:39:49 CDT 2018


Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/7928 )

Change subject: cdr_mysql: run a full reconnect on log if not connected
......................................................................


Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/7928/3/addons/cdr_mysql.c
File addons/cdr_mysql.c:

https://gerrit.asterisk.org/#/c/7928/3/addons/cdr_mysql.c@189
PS3, Line 189: 		struct ast_config *cfg = ast_config_load(config, config_flags);
             : 		ast_verb(3, "Not connected. Attempting to re-establish connection to MySQL CDR database.\n");
             : 		if (cfg == CONFIG_STATUS_FILEMISSING) {
             : 			ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config);
             : 		} else if (cfg == CONFIG_STATUS_FILEINVALID) {
             : 			ast_log(LOG_ERROR, "Unable to load configuration file '%s'\n", config);
             : 		} else {
             : 			int res;
             : 
             : 			AST_RWLIST_WRLOCK(&columns);
             : 			res = my_connect_db(cfg);
After you load the configuration the global strings are not being updated effectively making the config_load useless.

For instance, if hostname changes in the config, this will still try to connect to the previous hostname.

You need to check if the required configuration variables are valid, and then reset those variables. See 'my_load_config_string'. However that too will need to be modified to free any previously held value in order to avoid a memory leak.



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7603c7501dae7070fac35081cf35161579c47590
Gerrit-Change-Number: 7928
Gerrit-PatchSet: 3
Gerrit-Owner: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Oron Peled <oron.peled at xorcom.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Gerrit-Comment-Date: Tue, 08 May 2018 18:39:49 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180508/4425be20/attachment.html>


More information about the asterisk-code-review mailing list