aboutsummaryrefslogtreecommitdiffstats
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-23 16:53:52 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-23 16:53:52 +0000
commit49117809e47318400e72667ab884b8f86727cc76 (patch)
tree0ba219cf4a255dd0fa92b2e017dadbac29b6bf81 /main/astobj2.c
parent29b6e688cf787390d9ff0cea3da4e478e0497ee9 (diff)
This is a hack to maintain old behavior of chan_iax2. This ensures that if
the peers and users are being stored in a linked list, that they go in the list in the same order that the older code used. This is necessary to maintain the behavior of which peers and users get matched when traversing the container. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@80497 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 4f338af44..8c3e19446 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -316,7 +316,7 @@ struct bucket_list {
/*
* link an object to a container
*/
-void *ao2_link(ao2_container *c, void *user_data)
+void *__ao2_link(ao2_container *c, void *user_data, int iax2_hack)
{
int i;
/* create a new list entry */
@@ -339,7 +339,10 @@ void *ao2_link(ao2_container *c, void *user_data)
i %= c->n_buckets;
p->astobj = obj;
p->version = ast_atomic_fetchadd_int(&c->version, 1);
- AST_LIST_INSERT_TAIL(&c->buckets[i], p, entry);
+ if (iax2_hack)
+ AST_LIST_INSERT_HEAD(&c->buckets[i], p, entry);
+ else
+ AST_LIST_INSERT_TAIL(&c->buckets[i], p, entry);
ast_atomic_fetchadd_int(&c->elements, 1);
ao2_unlock(c);