[asterisk-commits] russell: branch russell/data_retrieval r115266 - /team/russell/data_retrieval...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 2 22:03:31 CDT 2008


Author: russell
Date: Fri May  2 22:03:31 2008
New Revision: 115266

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115266
Log:
Update chan_sip for astobj2 changes

Modified:
    team/russell/data_retrieval/channels/chan_sip.c

Modified: team/russell/data_retrieval/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/channels/chan_sip.c?view=diff&rev=115266&r1=115265&r2=115266
==============================================================================
--- team/russell/data_retrieval/channels/chan_sip.c (original)
+++ team/russell/data_retrieval/channels/chan_sip.c Fri May  2 22:03:31 2008
@@ -22562,29 +22562,35 @@
 {
 	struct ast_data_node *peers_node;
 	int res = 0;
+	struct ao2_iterator i;
+	struct sip_peer *peer;
 
 	if (!(peers_node = ast_data_node_new("sip_peers", "SIP Peers"))) {
 		return NULL;
 	}
 
-	ASTOBJ_CONTAINER_TRAVERSE(&peerl, !res, do {
+	i = ao2_iterator_init(peers, 0);
+	while ((peer = ao2_iterator_next(&i))) {
 		struct ast_data_node *peer_node;
 
 		if (!(peer_node = ast_data_node_add_child_grouping(peers_node, "peer", "SIP Peer"))) {
 			res = -1;
+			peer = unref_peer(peer, "");
 			break;
 		}
 
-		ASTOBJ_RDLOCK(iterator);
-
-		res |= ast_data_node_add_child_str(peer_node, "name", "Name", iterator->name);
+		ao2_lock(peer);
+
+		res |= ast_data_node_add_child_str(peer_node, "name", "Name", peer->name);
 		res |= ast_data_node_add_child_str(peer_node, "addr", "IP Address",
-			ast_inet_ntoa(iterator->addr.sin_addr));
+			ast_inet_ntoa(peer->addr.sin_addr));
 		res |= ast_data_node_add_child_bool(peer_node, "dynamic", "Dynamic Peer",
-			iterator->host_dynamic);
-
-		ASTOBJ_UNLOCK(iterator);
-	} while (0) );
+			peer->host_dynamic);
+
+		ao2_unlock(peer);
+
+		peer = unref_peer(peer, "");
+	}
 
 	if (res) {
 		peers_node = ast_data_node_destroy(peers_node);




More information about the asterisk-commits mailing list