[asterisk-commits] irroot: branch irroot/distrotech-customers-10 r335493 - in /team/irroot/distr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 12 15:31:38 CDT 2011


Author: irroot
Date: Mon Sep 12 15:31:32 2011
New Revision: 335493

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=335493
Log:
Changes to rb1402 patch, Conflict fix, Enable Automerge

Modified:
    team/irroot/distrotech-customers-10/   (props changed)
    team/irroot/distrotech-customers-10/apps/app_queue.c
    team/irroot/distrotech-customers-10/channels/chan_iax2.c
    team/irroot/distrotech-customers-10/channels/chan_sip.c

Propchange: team/irroot/distrotech-customers-10/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/irroot/distrotech-customers-10/
            ('svnmerge-integrated' removed)

Modified: team/irroot/distrotech-customers-10/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/apps/app_queue.c?view=diff&rev=335493&r1=335492&r2=335493
==============================================================================
--- team/irroot/distrotech-customers-10/apps/app_queue.c (original)
+++ team/irroot/distrotech-customers-10/apps/app_queue.c Mon Sep 12 15:31:32 2011
@@ -2460,7 +2460,8 @@
 	struct ao2_iterator mem_iter;
 
 	if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , SENTINEL))) {
-		/*This queue doesn't have realtime members*/		ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
+		/*This queue doesn't have realtime members*/
+		ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
 		return;
 	}
 
@@ -7126,6 +7127,7 @@
 	}
 
 	queue_iter = ao2_iterator_init(queues, AO2_ITERATOR_DONTLOCK);
+	ao2_lock(queues);
 	while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
 		float sl;
 		struct call_queue *realtime_queue = NULL;
@@ -7216,6 +7218,7 @@
 		queue_t_unref(q, "Done with iterator"); /* Unref the iterator's reference */
 	}
 	ao2_iterator_destroy(&queue_iter);
+	ao2_lock(queues);
 	if (!found) {
 		if (argc == 3)
 			ast_str_set(&out, 0, "No such queue: %s.", argv[2]);

Modified: team/irroot/distrotech-customers-10/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/channels/chan_iax2.c?view=diff&rev=335493&r1=335492&r2=335493
==============================================================================
--- team/irroot/distrotech-customers-10/channels/chan_iax2.c (original)
+++ team/irroot/distrotech-customers-10/channels/chan_iax2.c Mon Sep 12 15:31:32 2011
@@ -8584,6 +8584,7 @@
 	if (!(reg = ast_calloc(1, sizeof(*reg))))
 		return -1;
 
+	reg->addr.ss.ss_family = AF_INET;
 	if (ast_dnsmgr_lookup(hostname, &reg->addr, &reg->dnsmgr, srvlookup ? "_iax._udp" : NULL) < 0) {
 		ast_free(reg);
 		return -1;
@@ -12429,6 +12430,7 @@
 		peer->expire = -1;
 		peer->pokeexpire = -1;
 		peer->sockfd = defaultsockfd;
+		peer->addr.ss.ss_family = AF_INET;
 		if (ast_string_field_init(peer, 32))
 			peer = peer_unref(peer);
 	}

Modified: team/irroot/distrotech-customers-10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/channels/chan_sip.c?view=diff&rev=335493&r1=335492&r2=335493
==============================================================================
--- team/irroot/distrotech-customers-10/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-10/channels/chan_sip.c Mon Sep 12 15:31:32 2011
@@ -14374,9 +14374,7 @@
 {
 	struct sip_peer *peer = userdata;
 
-	ao2_lock(peer);
 	sip_send_mwi_to_peer(peer, 0);
-	ao2_unlock(peer);
 }
 
 static void network_change_event_subscribe(void)
@@ -24943,9 +24941,7 @@
 			ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
 			transmit_response(p, "200 OK", req);
 			if (p->relatedpeer) {	/* Send first notification */
-				ao2_lock(p->relatedpeer); /* was WRLOCK */
 				sip_send_mwi_to_peer(p->relatedpeer, 0);
-				ao2_unlock(p->relatedpeer);
 			}
 		} else if (p->subscribed != CALL_COMPLETION) {
 
@@ -25683,14 +25679,18 @@
 		}
 		ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
 	}
+	ao2_lock(peer);
 
 	if (peer->mwipvt) {
 		/* Base message on subscription */
 		p = dialog_ref(peer->mwipvt, "sip_send_mwi_to_peer: Setting dialog ptr p from peer->mwipvt-- should this be done?");
 	} else {
 		/* Build temporary dialog for this message */
-		if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL)))
+		if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL))) {
+			ao2_unlock(peer);
 			return -1;
+		}
+
 		/* If we don't set the socket type to 0, then create_addr_from_peer will fail immediately if the peer
 		 * uses any transport other than UDP. We set the type to 0 here and then let create_addr_from_peer copy
 		 * the peer's socket information to the sip_pvt we just allocated
@@ -25718,11 +25718,17 @@
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	}
 
+	/* We have multiple threads (mwi events and monitor retransmits) working with this PVT and as we modify the sip history if that's turned on,
+	   we really need to have a lock on it */
+	sip_pvt_lock(p);
+
 	/* Send MWI */
 	ast_set_flag(&p->flags[0], SIP_OUTGOING);
 	/* the following will decrement the refcount on p as it finishes */
 	transmit_notify_with_mwi(p, newmsgs, oldmsgs, peer->vmexten);
+	sip_pvt_unlock(p);
 	dialog_unref(p, "unref dialog ptr p just before it goes out of scope at the end of sip_send_mwi_to_peer.");
+	ao2_unlock(peer);
 	return 0;
 }
 
@@ -27257,6 +27263,9 @@
 	if (peer) {
 		/* Already in the list, remove it and it will be added back (or FREE'd)  */
 		found++;
+		/* we've unlinked the peer from the peers container but not unlinked from the peers_by_ip container yet
+		  this leads to a wrong refcounter and the peer object is never destroyed */
+		ao2_t_unlink(peers_by_ip, peer, "ao2_unlink peer from peers_by_ip table");
 		if (!(peer->the_mark))
 			firstpass = 0;
 	} else {




More information about the asterisk-commits mailing list