[asterisk-dev] [svn-commits] russell: branch 1.4 r80497 - in /branches/1.4: channels/ include/asterisk/ main/

Zoa zoachien at securax.org
Thu Aug 23 12:16:50 CDT 2007


I seem to remember something that different users / peers could be
matched when using realtime DB instead of a config file, maybe this
needs to be checked at the same time ?

( I'm no programmer though )

Joachim

SVN commits to the Digium repositories wrote:
> Author: russell
> Date: Thu Aug 23 11:53:52 2007
> New Revision: 80497
>
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=80497
> Log:
> 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.
>
> Modified:
>     branches/1.4/channels/chan_iax2.c
>     branches/1.4/include/asterisk/astobj2.h
>     branches/1.4/main/astobj2.c
>
> Modified: branches/1.4/channels/chan_iax2.c
> URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=80497&r1=80496&r2=80497
> ==============================================================================
> --- branches/1.4/channels/chan_iax2.c (original)
> +++ branches/1.4/channels/chan_iax2.c Thu Aug 23 11:53:52 2007
> @@ -9735,14 +9735,14 @@
>  					/* Start with general parameters, then specific parameters, user and peer */
>  					user = build_user(cat, gen, ast_variable_browse(ucfg, cat), 0);
>  					if (user) {
> -						ao2_link(users, user);
> +						__ao2_link(users, user, (MAX_PEER_BUCKETS == 1) ? 1 : 0);
>  						user = NULL;
>  					}
>  					peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
>  					if (peer) {
>  						if (ast_test_flag(peer, IAX_DYNAMIC))
>  							reg_source_db(peer);
> -						ao2_link(peers, peer);
> +						__ao2_link(peers, peer, (MAX_PEER_BUCKETS == 1) ? 1 : 0);
>  						peer = NULL;
>  					}
>  				}
> @@ -9779,7 +9779,7 @@
>  				if (!strcasecmp(utype, "user") || !strcasecmp(utype, "friend")) {
>  					user = build_user(cat, ast_variable_browse(cfg, cat), NULL, 0);
>  					if (user) {
> -						ao2_link(users, user);
> +						__ao2_link(users, user, (MAX_PEER_BUCKETS == 1) ? 1 : 0);
>  						user = NULL;
>  					}
>  				}
> @@ -9788,7 +9788,7 @@
>  					if (peer) {
>  						if (ast_test_flag(peer, IAX_DYNAMIC))
>  							reg_source_db(peer);
> -						ao2_link(peers, peer);
> +						__ao2_link(peers, peer, (MAX_PEER_BUCKETS == 1) ? 1 : 0);
>  						peer = NULL;
>  					}
>  				} else if (strcasecmp(utype, "user")) {
>
> Modified: branches/1.4/include/asterisk/astobj2.h
> URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/astobj2.h?view=diff&rev=80497&r1=80496&r2=80497
> ==============================================================================
> --- branches/1.4/include/asterisk/astobj2.h (original)
> +++ branches/1.4/include/asterisk/astobj2.h Thu Aug 23 11:53:52 2007
> @@ -368,8 +368,15 @@
>   * This function insert an object in a container according its key.
>   *
>   * \note Remember to set the key before calling this function.
> - */
> -void *ao2_link(ao2_container *c, void *newobj);
> + *
> + * For Asterisk 1.4 only, there is a dirty hack here to ensure that chan_iax2
> + * can have objects linked in to the container at the head instead of tail
> + * when it is just a linked list.  This is to maintain some existing behavior
> + * where the order must be maintained as it was before this conversion so that
> + * matching behavior doesn't change.
> + */
> +#define ao2_link(c, o) __ao2_link(c, o, 0)
> +void *__ao2_link(ao2_container *c, void *newobj, int iax2_hack);
>  void *ao2_unlink(ao2_container *c, void *newobj);
>  
>  /*! \struct Used as return value if the flag OBJ_MULTIPLE is set */
>
> Modified: branches/1.4/main/astobj2.c
> URL: http://svn.digium.com/view/asterisk/branches/1.4/main/astobj2.c?view=diff&rev=80497&r1=80496&r2=80497
> ==============================================================================
> --- branches/1.4/main/astobj2.c (original)
> +++ branches/1.4/main/astobj2.c Thu Aug 23 11:53:52 2007
> @@ -316,7 +316,7 @@
>  /*
>   * 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 @@
>  	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);
>  	
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> svn-commits mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/svn-commits
>   





More information about the asterisk-dev mailing list