fix various bugs related to list handling of channel variables (issue #5548)
use nolock lists for channel variables, since no locks are needed (these lists are either temporary or protected by the channel's own lock) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6900 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
8615ded129
commit
3b5ed22f12
|
@ -585,7 +585,7 @@ struct ast_channel *ast_channel_alloc(int needqueue)
|
|||
snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
|
||||
headp = &tmp->varshead;
|
||||
ast_mutex_init(&tmp->lock);
|
||||
AST_LIST_HEAD_INIT(headp);
|
||||
AST_LIST_HEAD_INIT_NOLOCK(headp);
|
||||
strcpy(tmp->context, "default");
|
||||
ast_copy_string(tmp->language, defaultlanguage, sizeof(tmp->language));
|
||||
strcpy(tmp->exten, "s");
|
||||
|
@ -2976,7 +2976,7 @@ int ast_do_masquerade(struct ast_channel *original)
|
|||
original->fds[x] = clone->fds[x];
|
||||
}
|
||||
clone_variables(original, clone);
|
||||
clone->varshead.first = NULL;
|
||||
AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
|
||||
/* Presense of ADSI capable CPE follows clone */
|
||||
original->adsicpe = clone->adsicpe;
|
||||
/* Bridge remains the same */
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "asterisk/channel.h"
|
||||
|
||||
struct ast_channel;
|
||||
AST_LIST_HEAD(varshead,ast_var_t);
|
||||
|
||||
/*! Responsible for call detail data */
|
||||
struct ast_cdr {
|
||||
|
|
|
@ -31,6 +31,8 @@ struct ast_var_t {
|
|||
char name[0];
|
||||
};
|
||||
|
||||
AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
|
||||
|
||||
struct ast_var_t *ast_var_assign(const char *name, const char *value);
|
||||
void ast_var_delete(struct ast_var_t *var);
|
||||
char *ast_var_name(struct ast_var_t *var);
|
||||
|
|
|
@ -369,6 +369,8 @@ struct { \
|
|||
#define AST_LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.next = (head)->first; \
|
||||
(head)->first = (elm); \
|
||||
if (!(head)->last) \
|
||||
(head)->last = (elm); \
|
||||
} while (0)
|
||||
|
||||
/*!
|
||||
|
|
2
pbx.c
2
pbx.c
|
@ -6150,7 +6150,7 @@ int load_pbx(void)
|
|||
ast_verbose( "Asterisk PBX Core Initializing\n");
|
||||
ast_verbose( "Registering builtin applications:\n");
|
||||
}
|
||||
AST_LIST_HEAD_INIT(&globals);
|
||||
AST_LIST_HEAD_INIT_NOLOCK(&globals);
|
||||
ast_cli_register_multiple(pbx_cli, sizeof(pbx_cli) / sizeof(pbx_cli[0]));
|
||||
|
||||
/* Register builtin applications */
|
||||
|
|
|
@ -559,7 +559,7 @@ static int dundi_lookup_local(struct dundi_result *dr, struct dundi_mapping *map
|
|||
dr[anscnt].eid = *us_eid;
|
||||
dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
|
||||
if (ast_test_flag(&flags, DUNDI_FLAG_EXISTS)) {
|
||||
AST_LIST_HEAD_INIT(&headp);
|
||||
AST_LIST_HEAD_INIT_NOLOCK(&headp);
|
||||
newvariable = ast_var_assign("NUMBER", called_number);
|
||||
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
|
||||
newvariable = ast_var_assign("EID", dr[anscnt].eid_str);
|
||||
|
|
|
@ -88,7 +88,7 @@ static char *loopback_helper(char *buf, int buflen, const char *exten, const cha
|
|||
|
||||
snprintf(tmp, sizeof(tmp), "%d", priority);
|
||||
memset(buf, 0, buflen);
|
||||
AST_LIST_HEAD_INIT(&headp);
|
||||
AST_LIST_HEAD_INIT_NOLOCK(&headp);
|
||||
newvariable = ast_var_assign("EXTEN", exten);
|
||||
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
|
||||
newvariable = ast_var_assign("CONTEXT", context);
|
||||
|
|
Reference in New Issue