[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r118162 - in /team/sean...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 23 16:21:31 CDT 2008
Author: seanbright
Date: Fri May 23 16:21:31 2008
New Revision: 118162
URL: http://svn.digium.com/view/asterisk?view=rev&rev=118162
Log:
Merged revisions 117983,117986,117988,118020,118049,118053,118059,118101,118129,118157,118159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r117983 | tilghman | 2008-05-22 17:27:00 -0400 (Thu, 22 May 2008) | 2 lines
Fix trunk breakage
................
r117986 | tilghman | 2008-05-22 17:42:50 -0400 (Thu, 22 May 2008) | 2 lines
Add a compatibility option for upgrading realtime extensions
................
r117988 | seanbright | 2008-05-22 17:43:54 -0400 (Thu, 22 May 2008) | 1 line
Split the compile flags out and wire up some dependencies
................
r118020 | phsultan | 2008-05-23 06:33:21 -0400 (Fri, 23 May 2008) | 15 lines
- remove whitespaces between tags in received XML packets before giving
them to the parser ;
- report Gtalk error messages from a buddy to the console.
This patch makes Asterisk "Google Jingle" (chan_gtalk) implementation
work with Empathy. Note that this is only true for audio streams, not
video.
Thank you to PH for his great help!
(closes issue #12647)
Reported by: PH
Patches:
trunk-12647-1.diff uploaded by phsultan (license 73)
Tested by: phsultan, PH
................
r118049 | russell | 2008-05-23 08:37:31 -0400 (Fri, 23 May 2008) | 17 lines
Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines
Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.
http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline
(closes issue #12289)
Reported by: francesco_r
Patches by Tilghman, final patch by me
........
................
r118053 | tilghman | 2008-05-23 09:00:10 -0400 (Fri, 23 May 2008) | 11 lines
Merged revisions 118052 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r118052 | tilghman | 2008-05-23 07:59:16 -0500 (Fri, 23 May 2008) | 3 lines
Add information on using the Asterisk console, including tab command line
completion. (Closes issue #12681)
........
................
r118059 | tilghman | 2008-05-23 09:20:13 -0400 (Fri, 23 May 2008) | 9 lines
Blocked revisions 118055 via svnmerge
........
r118055 | tilghman | 2008-05-23 08:18:44 -0500 (Fri, 23 May 2008) | 2 lines
Add format type checking for recently de-inlined function
........
................
r118101 | mvanbaak | 2008-05-23 13:12:04 -0400 (Fri, 23 May 2008) | 15 lines
add option 'a' to chanisavail.
If you give chanisavail a list of channels, it will only
return the first available channel.
When this option is set, it will return all the available
channels from the given list.
(closes issue #12248)
Reported by: dagmoller
Patches:
app_chanisavail-snv.patch-v2.txt uploaded by dagmoller (license 436)
- major changes by me because russellb pointed out some buffer overflows
and codeguideline issues.
Converted it all to the ast_str_* api
Tested by: dagmoller, mvanbaak
................
r118129 | tilghman | 2008-05-23 14:09:14 -0400 (Fri, 23 May 2008) | 3 lines
Protect the object from changing while the 'odbc show' CLI command is running
(Closes issue #12704)
................
r118157 | mmichelson | 2008-05-23 15:57:40 -0400 (Fri, 23 May 2008) | 10 lines
Use a deep copy on strings that come from ast_events. Otherwise it is
likely that after the event is freed, we no longer refer to valid memory.
(closes issue #12712)
Reported by: tomo1657
Patches:
12712.patch uploaded by putnopvut (license 60)
Tested by: tomo1657
................
r118159 | mmichelson | 2008-05-23 16:55:02 -0400 (Fri, 23 May 2008) | 4 lines
Get rid of warnings for those silly compilers which warn when freeing
a const pointer
................
Added:
team/seanbright/resolve-shadow-warnings/configs/pbx_realtime.conf
- copied unchanged from r118159, trunk/configs/pbx_realtime.conf
team/seanbright/resolve-shadow-warnings/doc/cli.txt
- copied unchanged from r118159, trunk/doc/cli.txt
Modified:
team/seanbright/resolve-shadow-warnings/ (props changed)
team/seanbright/resolve-shadow-warnings/CHANGES
team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c
team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c
team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc
team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h
team/seanbright/resolve-shadow-warnings/main/utils.c
team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
team/seanbright/resolve-shadow-warnings/res/res_jabber.c
team/seanbright/resolve-shadow-warnings/res/res_odbc.c
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 23 16:21:31 2008
@@ -1,1 +1,1 @@
-/trunk:1-117958
+/trunk:1-118160
Modified: team/seanbright/resolve-shadow-warnings/CHANGES
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/CHANGES?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/CHANGES (original)
+++ team/seanbright/resolve-shadow-warnings/CHANGES Fri May 23 16:21:31 2008
@@ -75,6 +75,8 @@
* ExternalIVR now takes several options that affect the way it performs, as
well as having several new commands. Please see doc/externalivr.txt for the
complete documentation.
+ * ChanIsAvail has a new option, 'a', which will return all available channels instead
+ of just the first one if you give the function more then one channel to check.
SIP Changes
-----------
Modified: team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c Fri May 23 16:21:31 2008
@@ -50,6 +50,7 @@
"This application will check to see if any of the specified channels are\n"
"available.\n"
" Options:\n"
+" a - Check for all available channels, not only the first one.\n"
" s - Consider the channel unavailable if the channel is in use at all.\n"
" t - Simply checks if specified channels exist in the channel list\n"
" (implies option s).\n"
@@ -61,9 +62,12 @@
static int chanavail_exec(struct ast_channel *chan, void *data)
{
- int res=-1, inuse=-1, option_state=0, string_compare=0;
+ int inuse=-1, option_state=0, string_compare=0, option_all_avail=0;
int status;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
+ struct ast_str *tmp_availchan = ast_str_alloca(2048);
+ struct ast_str *tmp_availorig = ast_str_alloca(2048);
+ struct ast_str *tmp_availstat = ast_str_alloca(2048);
struct ast_channel *tempchan;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(reqchans);
@@ -80,10 +84,15 @@
AST_STANDARD_APP_ARGS(args, info);
if (args.options) {
- if (strchr(args.options, 's'))
+ if (strchr(args.options, 'a')) {
+ option_all_avail = 1;
+ }
+ if (strchr(args.options, 's')) {
option_state = 1;
- if (strchr(args.options, 't'))
+ }
+ if (strchr(args.options, 't')) {
string_compare = 1;
+ }
}
peers = args.reqchans;
if (peers) {
@@ -119,27 +128,32 @@
status = inuse = ast_device_state(trychan);
}
if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
- /* Store the originally used channel too */
+ ast_str_append(&tmp_availchan, 0, "%s%s", tmp_availchan->used ? "&" : "", tempchan->name);
+
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp);
+ ast_str_append(&tmp_availorig, 0, "%s%s", tmp_availorig->used ? "&" : "", tmp);
+
snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
+ ast_str_append(&tmp_availstat, 0, "%s%s", tmp_availstat->used ? "&" : "", tmp);
+
ast_hangup(tempchan);
tempchan = NULL;
- res = 1;
- break;
+
+ if (!option_all_avail) {
+ break;
+ }
} else {
snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
+ ast_str_append(&tmp_availstat, 0, "%s%s", tmp_availstat->used ? "&" : "", tmp);
}
cur = rest;
} while (cur);
}
- if (res < 1) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
- }
+
+ pbx_builtin_setvar_helper(chan, "AVAILCHAN", tmp_availchan->str);
+ /* Store the originally used channel too */
+ pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp_availorig->str);
+ pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp_availstat->str);
return 0;
}
Modified: team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c Fri May 23 16:21:31 2008
@@ -9165,6 +9165,8 @@
AST_RWLIST_WRLOCK(&mwi_subs);
AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
AST_RWLIST_UNLOCK(&mwi_subs);
+ ast_free((void *) p->mailbox);
+ ast_free((void *) p->context);
ast_free(p);
return 0;
}
@@ -9199,8 +9201,8 @@
ast_log(LOG_ERROR, "could not allocate a mwi_sub_task\n");
return;
}
- mwist->mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
- mwist->context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
+ mwist->mailbox = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX));
+ mwist->context = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT));
mwist->uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c Fri May 23 16:21:31 2008
@@ -1702,7 +1702,10 @@
{
struct gtalk *client = ASTOBJ_REF((struct gtalk *) data);
- if (iks_find_with_attrib(pak->x, "session", "type", "initiate")) {
+ if (iks_find_attrib(pak->x, "type") && !strcmp(iks_find_attrib (pak->x, "type"),"error")) {
+ ast_log(LOG_NOTICE, "Remote peer reported an error, trying to establish the call anyway\n");
+ }
+ else if (iks_find_with_attrib(pak->x, "session", "type", "initiate")) {
/* New call */
gtalk_newcall(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info")) {
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c Fri May 23 16:21:31 2008
@@ -35,14 +35,21 @@
/*** MODULEINFO
<depend>ossaudio</depend>
- <depend>usb</depend>
+ <depend>usb</depend>
<defaultenabled>no</defaultenabled>
- <member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming">
- <defaultenabled>no</defaultenabled>
- </member>
- <member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols">
- <defaultenabled>no</defaultenabled>
- </member>
+ ***/
+
+/*** MAKEOPTS
+<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
+ <member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming">
+ <defaultenabled>no</defaultenabled>
+ <depend>chan_usbradio</depend>
+ </member>
+ <member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols">
+ <defaultenabled>no</defaultenabled>
+ <depend>chan_usbradio</depend>
+ </member>
+</category>
***/
// 20070918 1600 EDT sph at xelatec.com changing to rx driven streams
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc Fri May 23 16:21:31 2008
@@ -2226,7 +2226,7 @@
/* Apply extra gain ! */
if( p->txswgain > MAX_VPB_GAIN )
- a_gain_vector(p->txswgain - MAX_VPB_GAIN , (short*)frame->data, frame->datalen / sizeof(short));
+ a_gain_vector(p->txswgain - MAX_VPB_GAIN , (short*)frame->data.ptr, frame->datalen / sizeof(short));
/* ast_debug(1, "%s: vpb_write: Applied gain..\n", p->dev); */
/* ast_debug(1, "%s: vpb_write: play_buf_time %d\n", p->dev, p->play_buf_time); */
@@ -2234,9 +2234,9 @@
if ((p->read_state == 1) && (p->play_buf_time < 5)){
play_buf_time_start = ast_tvnow();
/* res = vpb_play_buf_sync(p->handle, (char *)frame->data, tdiff * 8 * 2); */
- res = vpb_play_buf_sync(p->handle, (char *)frame->data, frame->datalen);
+ res = vpb_play_buf_sync(p->handle, (char *)frame->data.ptr, frame->datalen);
if(res == VPB_OK) {
- short * data = (short*)frame->data;
+ short * data = (short*)frame->data.ptr;
ast_verb(6, "%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0], data[1]);
}
p->play_buf_time = ast_tvdiff_ms(ast_tvnow(), play_buf_time_start);
@@ -2392,7 +2392,7 @@
ast_verb(6, "%s: chanreads: applied gain\n", p->dev);
fr->subclass = afmt;
- fr->data = readbuf;
+ fr->data.ptr = readbuf;
fr->datalen = readlen;
fr->frametype = AST_FRAME_VOICE;
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h Fri May 23 16:21:31 2008
@@ -554,21 +554,8 @@
#define ast_asprintf(ret, fmt, ...) \
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
-AST_INLINE_API(
-__attribute__((format (printf, 5, 6)))
-int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
-{
- int res;
- va_list ap;
-
- va_start(ap, fmt);
- if ((res = vasprintf(ret, fmt, ap)) == -1)
- MALLOC_FAILURE_MSG;
- va_end(ap);
-
- return res;
-}
-)
+int __attribute__((format (printf, 5, 6)))
+ _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...);
/*!
* \brief A wrapper for vasprintf()
Modified: team/seanbright/resolve-shadow-warnings/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/main/utils.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/main/utils.c (original)
+++ team/seanbright/resolve-shadow-warnings/main/utils.c Fri May 23 16:21:31 2008
@@ -1632,3 +1632,19 @@
#endif
return 0;
}
+
+#ifndef __AST_DEBUG_MALLOC
+int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...)
+{
+ int res;
+ va_list ap;
+
+ va_start(ap, fmt);
+ if ((res = vasprintf(ret, fmt, ap)) == -1) {
+ MALLOC_FAILURE_MSG;
+ }
+ va_end(ap);
+
+ return res;
+}
+#endif
Modified: team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c (original)
+++ team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c Fri May 23 16:21:31 2008
@@ -53,6 +53,8 @@
#define EXT_DATA_SIZE 256
+/* If set to 0, translate commas to "\," and pipes to "," */
+static int compat16 = 1;
/* Realtime switch looks up extensions in the supplied realtime table.
@@ -176,8 +178,24 @@
for (v = var; v ; v = v->next) {
if (!strcasecmp(v->name, "app"))
app = ast_strdupa(v->value);
- else if (!strcasecmp(v->name, "appdata"))
- tmp = ast_strdupa(v->value);
+ else if (!strcasecmp(v->name, "appdata")) {
+ if (!compat16) {
+ char *ptr;
+ tmp = alloca(strlen(v->value) * 2 + 1);
+ for (ptr = tmp; *v->value; v->value++) {
+ if (*v->value == ',') {
+ *ptr++ = '\\';
+ *ptr++ = ',';
+ } else if (*v->value == '|') {
+ *ptr++ = ',';
+ } else {
+ *ptr++ = *v->value;
+ }
+ }
+ } else {
+ tmp = ast_strdupa(v->value);
+ }
+ }
}
ast_variables_destroy(var);
if (!ast_strlen_zero(app)) {
@@ -243,6 +261,18 @@
static int load_module(void)
{
+ struct ast_flags flags = { 0 };
+ struct ast_config *cfg = ast_config_load("pbx_realtime.conf", flags);
+ if (cfg) {
+ const char *tmp = ast_variable_retrieve(cfg, "general", "compat");
+ if (tmp && strncmp(tmp, "1.6", 3)) {
+ compat16 = 0;
+ } else {
+ compat16 = 1;
+ }
+ ast_config_destroy(cfg);
+ }
+
if (ast_register_switch(&realtime_switch))
return AST_MODULE_LOAD_FAILURE;
return AST_MODULE_LOAD_SUCCESS;
Modified: team/seanbright/resolve-shadow-warnings/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/res/res_jabber.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/res/res_jabber.c (original)
+++ team/seanbright/resolve-shadow-warnings/res/res_jabber.c Fri May 23 16:21:31 2008
@@ -35,6 +35,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include <ctype.h>
#include <iksemel.h>
#include "asterisk/channel.h"
@@ -638,23 +639,53 @@
{
int len, ret;
char buf[NET_IO_BUF_SIZE -1];
+ char newbuf[NET_IO_BUF_SIZE -1];
+ int pos = 0;
+ int newbufpos = 0;
+ unsigned char c;
memset(buf, 0, sizeof(buf));
+ memset(newbuf, 0, sizeof(newbuf));
while (1) {
len = aji_io_recv(client, buf, NET_IO_BUF_SIZE - 1, timeout);
if (len < 0) return IKS_NET_RWERR;
if (len == 0) return IKS_NET_EXPIRED;
buf[len] = '\0';
-
+
+ /* our iksemel parser won't work as expected if we feed
+ it with XML packets that contain multiple whitespace
+ characters between tags */
+ while (pos < len) {
+ c = buf[pos];
+ /* if we stumble on the ending tag character,
+ we skip any whitespace that follows it*/
+ if (c == '>') {
+ while (isspace(buf[pos+1])) {
+ pos++;
+ }
+ }
+ newbuf[newbufpos] = c;
+ newbufpos ++;
+ pos++;
+ }
+ pos = 0;
+ newbufpos = 0;
+
/* Log the message here, because iksemel's logHook is
unaccessible */
aji_log_hook(client, buf, len, 1);
-
- ret = iks_parse(client->p, buf, len, 0);
+
+ /* let iksemel deal with the string length,
+ and reset our buffer */
+ ret = iks_parse(client->p, newbuf, 0, 0);
+ memset(newbuf, 0, sizeof(newbuf));
+
if (ret != IKS_OK) {
+ ast_log(LOG_WARNING, "XML parsing failed\n");
return ret;
}
+ ast_debug(3, "XML parsing successful\n");
}
return IKS_OK;
}
Modified: team/seanbright/resolve-shadow-warnings/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/res/res_odbc.c?view=diff&rev=118162&r1=118161&r2=118162
==============================================================================
--- team/seanbright/resolve-shadow-warnings/res/res_odbc.c (original)
+++ team/seanbright/resolve-shadow-warnings/res/res_odbc.c Fri May 23 16:21:31 2008
@@ -417,9 +417,11 @@
ast_cli(a->fd, " Pooled: Yes\n Limit: %d\n Connections in use: %d\n", class->limit, class->count);
while ((current = ao2_iterator_next(&aoi2))) {
+ ast_mutex_lock(¤t->lock);
ast_cli(a->fd, " - Connection %d: %s\n", ++count,
current->used ? "in use" :
current->up && ast_odbc_sanity_check(current) ? "connected" : "disconnected");
+ ast_mutex_unlock(¤t->lock);
ao2_ref(current, -1);
}
} else {
@@ -497,7 +499,9 @@
aoi = ao2_iterator_init(class->obj_container, 0);
while ((obj = ao2_iterator_next(&aoi))) {
if (! obj->used) {
+ ast_mutex_lock(&obj->lock);
obj->used = 1;
+ ast_mutex_unlock(&obj->lock);
break;
}
ao2_ref(obj, -1);
More information about the asterisk-commits
mailing list