[asterisk-commits] may: branch may/ooh323_ipv6 r307877 - in /team/may/ooh323_ipv6: ./ addons/ ad...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 15 06:11:28 CST 2011
Author: may
Date: Tue Feb 15 06:11:23 2011
New Revision: 307877
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307877
Log:
Merged revisions 307795,307838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r307795 | tilghman | 2011-02-14 23:18:02 +0300 (Mon, 14 Feb 2011) | 22 lines
Merged revisions 307793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r307793 | tilghman | 2011-02-14 14:16:55 -0600 (Mon, 14 Feb 2011) | 15 lines
Merged revisions 307792 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r307792 | tilghman | 2011-02-14 14:10:28 -0600 (Mon, 14 Feb 2011) | 8 lines
Increment usage count at first reference, to avoid a race condition with many threads creating connections all at once.
(issue #18156)
Reported by: asgaroth
Patches:
20110214__issue18156.diff.txt uploaded by tilghman (license 14)
Tested by: tilghman
........
................
................
r307838 | tilghman | 2011-02-15 10:03:44 +0300 (Tue, 15 Feb 2011) | 22 lines
Merged revisions 307837 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r307837 | tilghman | 2011-02-15 01:02:45 -0600 (Tue, 15 Feb 2011) | 15 lines
Merged revisions 307836 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r307836 | tilghman | 2011-02-15 01:01:37 -0600 (Tue, 15 Feb 2011) | 8 lines
Need to retrieve the rows affected before using the associated variable.
(closes issue #18795)
Reported by: irroot
Patches:
20110211__issue18795.diff.txt uploaded by tilghman (license 14)
Tested by: tilghman
........
................
................
Modified:
team/may/ooh323_ipv6/ (props changed)
team/may/ooh323_ipv6/addons/chan_ooh323.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooCmdChannel.c
team/may/ooh323_ipv6/apps/app_dial.c
team/may/ooh323_ipv6/apps/app_queue.c
team/may/ooh323_ipv6/cel/cel_odbc.c (props changed)
team/may/ooh323_ipv6/configs/cel_odbc.conf.sample (props changed)
team/may/ooh323_ipv6/funcs/func_odbc.c
team/may/ooh323_ipv6/res/res_odbc.c
team/may/ooh323_ipv6/sounds/Makefile (props changed)
Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
automerge = *
Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
svn:mergeinfo = /trunk:307751-307752
Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb 15 06:11:23 2011
@@ -1,1 +1,1 @@
-/trunk:1-307713
+/trunk:1-307876
Modified: team/may/ooh323_ipv6/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/chan_ooh323.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/chan_ooh323.c Tue Feb 15 06:11:23 2011
@@ -1222,18 +1222,18 @@
}
break;
case AST_CONTROL_RINGING:
- if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
- if (!p->alertsent) {
- if (gH323Debug) {
- ast_debug(1, "Sending manual ringback for %s, res = %d\n",
- callToken,
- ooManualRingback(callToken));
- } else {
- ooManualRingback(callToken);
+ if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
+ if (!p->alertsent) {
+ if (gH323Debug) {
+ ast_debug(1, "Sending manual ringback for %s, res = %d\n",
+ callToken,
+ ooManualRingback(callToken));
+ } else {
+ ooManualRingback(callToken);
+ }
+ p->alertsent = 1;
}
- p->alertsent = 1;
- }
- }
+ }
break;
case AST_CONTROL_SRCUPDATE:
ast_rtp_instance_update_source(p->rtp);
@@ -4148,7 +4148,7 @@
memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
ast_mutex_unlock(&p->lock);
- free(callToken);
+ /* free(callToken); */
return 0;
}
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooCmdChannel.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooCmdChannel.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooCmdChannel.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooCmdChannel.c Tue Feb 15 06:11:23 2011
@@ -56,7 +56,7 @@
OOTRACEINFO2("INFO: create cmd connect for call: %lx\n", call);
- call->CmdChanLock = ast_calloc(1, sizeof(ast_mutex_t));
+ call->CmdChanLock = calloc(1, sizeof(ast_mutex_t));
ast_mutex_init(call->CmdChanLock);
Modified: team/may/ooh323_ipv6/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/apps/app_dial.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/apps/app_dial.c (original)
+++ team/may/ooh323_ipv6/apps/app_dial.c Tue Feb 15 06:11:23 2011
@@ -2508,14 +2508,24 @@
gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ',');
if (gosub_argstart) {
+ const char *what_is_s = "s";
*gosub_argstart = 0;
- if (asprintf(&gosub_args, "%s,s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1) < 0) {
+ if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
+ ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
+ what_is_s = "~~s~~";
+ }
+ if (asprintf(&gosub_args, "%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
gosub_args = NULL;
}
*gosub_argstart = ',';
} else {
- if (asprintf(&gosub_args, "%s,s,1", opt_args[OPT_ARG_CALLEE_GOSUB]) < 0) {
+ const char *what_is_s = "s";
+ if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
+ ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
+ what_is_s = "~~s~~";
+ }
+ if (asprintf(&gosub_args, "%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
gosub_args = NULL;
}
Modified: team/may/ooh323_ipv6/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/apps/app_queue.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/apps/app_queue.c (original)
+++ team/may/ooh323_ipv6/apps/app_queue.c Tue Feb 15 06:11:23 2011
@@ -4931,14 +4931,24 @@
gosub_argstart = strchr(gosubexec, ',');
if (gosub_argstart) {
+ const char *what_is_s = "s";
*gosub_argstart = 0;
- if (asprintf(&gosub_args, "%s,s,1(%s)", gosubexec, gosub_argstart + 1) < 0) {
+ if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
+ ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
+ what_is_s = "~~s~~";
+ }
+ if (asprintf(&gosub_args, "%s,%s,1(%s)", gosubexec, what_is_s, gosub_argstart + 1) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
gosub_args = NULL;
}
*gosub_argstart = ',';
} else {
- if (asprintf(&gosub_args, "%s,s,1", gosubexec) < 0) {
+ const char *what_is_s = "s";
+ if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
+ ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
+ what_is_s = "~~s~~";
+ }
+ if (asprintf(&gosub_args, "%s,%s,1", gosubexec, what_is_s) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
gosub_args = NULL;
}
Propchange: team/may/ooh323_ipv6/cel/cel_odbc.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 15 06:11:23 2011
@@ -1,2 +1,2 @@
/be/branches/C.3/cel/cel_adaptive_odbc.c:256426
-/trunk/cel/cel_odbc.c:290061-306867
+/trunk/cel/cel_odbc.c:290061-306867,307751-307752
Propchange: team/may/ooh323_ipv6/configs/cel_odbc.conf.sample
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 15 06:11:23 2011
@@ -1,2 +1,2 @@
/be/branches/C.3/configs/cel_adaptive_odbc.conf.sample:256426
-/trunk/configs/cel_odbc.conf.sample:290061-306867
+/trunk/configs/cel_odbc.conf.sample:290061-306867,307751-307752
Modified: team/may/ooh323_ipv6/funcs/func_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/funcs/func_odbc.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/funcs/func_odbc.c (original)
+++ team/may/ooh323_ipv6/funcs/func_odbc.c Tue Feb 15 06:11:23 2011
@@ -336,6 +336,10 @@
}
}
+ if (stmt) {
+ SQLRowCount(stmt, &rows);
+ }
+
if (stmt && rows == 0 && ast_str_strlen(insertbuf) != 0) {
SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
@@ -356,7 +360,6 @@
}
} else if (stmt) {
status = "SUCCESS";
- SQLRowCount(stmt, &rows);
}
AST_RWLIST_UNLOCK(&queries);
Modified: team/may/ooh323_ipv6/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/res/res_odbc.c?view=diff&rev=307877&r1=307876&r2=307877
==============================================================================
--- team/may/ooh323_ipv6/res/res_odbc.c (original)
+++ team/may/ooh323_ipv6/res/res_odbc.c Tue Feb 15 06:11:23 2011
@@ -1218,13 +1218,14 @@
if (obj) {
ast_assert(ao2_ref(obj, 0) > 1);
}
- if (!obj && (class->count < class->limit) &&
+ if (!obj && (ast_atomic_fetchadd_int(&class->count, +1) < class->limit) &&
(time(NULL) > class->last_negative_connect.tv_sec + class->negative_connection_cache.tv_sec)) {
obj = ao2_alloc(sizeof(*obj), odbc_obj_destructor);
if (!obj) {
class->count--;
ao2_ref(class, -1);
ast_debug(3, "Unable to allocate object\n");
+ ast_atomic_fetchadd_int(&class->count, -1);
return NULL;
}
ast_assert(ao2_ref(obj, 0) == 1);
@@ -1235,14 +1236,18 @@
if (odbc_obj_connect(obj) == ODBC_FAIL) {
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
ao2_ref(obj, -1);
+ obj = NULL;
ast_assert(ao2_ref(class, 0) > 0);
- obj = NULL;
+ ast_atomic_fetchadd_int(&class->count, -1);
} else {
obj->used = 1;
ao2_link(obj->parent->obj_container, obj);
- ast_atomic_fetchadd_int(&obj->parent->count, +1);
}
} else {
+ /* If construction fails due to the limit (or negative timecache), reverse our increment. */
+ if (!obj) {
+ ast_atomic_fetchadd_int(&class->count, -1);
+ }
/* Object is not constructed, so delete outstanding reference to class. */
ao2_ref(class, -1);
class = NULL;
Propchange: team/may/ooh323_ipv6/sounds/Makefile
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 15 06:11:23 2011
@@ -1,2 +1,2 @@
/be/branches/C.3/sounds/Makefile:256426
-/trunk/sounds/Makefile:270974,290061-306867
+/trunk/sounds/Makefile:270974,290061-306867,307751-307752
More information about the asterisk-commits
mailing list