[Asterisk-code-review] func odbc: single database connection should be optional (asterisk[13])
Alexei Gradinari
asteriskteam at digium.com
Fri May 13 12:14:57 CDT 2016
Alexei Gradinari has posted comments on this change.
Change subject: func_odbc: single database connection should be optional
......................................................................
Patch Set 3:
(4 comments)
https://gerrit.asterisk.org/#/c/2800/3/funcs/func_odbc.c
File funcs/func_odbc.c:
Line 349: if (single_db_connection) {
> Remove the check of single_db_connection from here.
Done
Line 1756: ast_log(LOG_NOTICE, "Single database connection per DSN\n");
> This looks like some debugging that you probably meant to remove.
It's not debugging, it's notice that single connection is used.
Line 1850: ast_log(LOG_NOTICE, "Single database connection per DSN\n");
> More extra debugging.
the same... notice about single connection
PS3, Line 1833:
: if (single_db_connection) {
: ao2_ref(dsns, -1);
: }
:
: if (cfg && (s = ast_variable_retrieve(cfg, "general", "single_db_connection"))) {
: single_db_connection = ast_true(s);
: } else {
: single_db_connection = DEFAULT_SINGLE_DB_CONNECTION;
: }
:
: if (single_db_connection) {
: dsns = ao2_container_alloc(DSN_BUCKETS, dsn_hash, dsn_cmp);
: if (!dsns) {
: ast_log(LOG_ERROR, "Could not initialize DSN container\n");
: return 0;
: }
: ast_log(LOG_NOTICE, "Single database connection per DSN\n");
: }
> This code is structured cleanly, but on a reload there are chances for race
I decided to remove unreferencing and reallocating dsns container on reload.
Only one small drawback in case when we switching from single to multi that a memory for dsns is not freed.
--
To view, visit https://gerrit.asterisk.org/2800
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I57d990616c957dabf7597dea5d5c3148f459dfb6
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list