[asterisk-commits] rizzo: branch rizzo/astobj2 r77655 - /team/rizzo/astobj2/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jul 28 19:09:05 CDT 2007


Author: rizzo
Date: Sat Jul 28 19:09:05 2007
New Revision: 77655

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77655
Log:
more diff reduction against trunk

Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=77655&r1=77654&r2=77655
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sat Jul 28 19:09:05 2007
@@ -8126,20 +8126,20 @@
 
 	r->timeout = -1;	/* reset event reference */
 	ast_log(LOG_NOTICE, "   -- Registration for '%s@%s' timed out, trying again (Attempt #%d)\n", r->username, r->hostname, r->regattempts); 
-	/* if the initial tranmission failed, we may not have an existing dialog,
+	/* If the initial tranmission failed, we may not have an existing dialog,
 	 * so it is possible that r->call == NULL.
-	 * In any case we have a timeout so we don't want it.
+	 * Otherwise destroy it, as we have a timeout so we don't want it.
 	 */
 	if (r->call) {
 		/* Unlink us, destroy old call.  Locking is not relevant here because all this happens
 		   in the single SIP manager thread. */
-		/* XXX p->registry == r so and r has 2 refs, so the unref won't take the object away */
 		p = r->call;
 		p->needdestroy = 1;	/* XXX why do that if we are going to kill it in a moment ? */
 		/* Pretend to ACK anything just in case */
 		__sip_pretend_ack(p); /* XXX we need p locked, not sure we have */
 
 		/* decouple the two objects */
+		/* p->registry == r, so r has 2 refs, and the unref won't take the object away */
 		if (p->registry)
 			p->registry = registry_unref(p->registry);
 		r->call = dialog_unref(r->call);	/* reference goes away */
@@ -8157,6 +8157,7 @@
 		res=transmit_register(r, NULL, NULL);
 	}
 	manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n", r->username, r->hostname, regstate2str(r->regstate));
+	registry_unref(r);
 	return 0;
 }
 
@@ -8780,7 +8781,7 @@
 
 		destroy_association(peer);
 		
-		register_peer_exten(peer, FALSE);	/* Add extension from regexten= setting in sip.conf */
+		register_peer_exten(peer, FALSE);	/* Remove extension from regexten= setting in sip.conf */
 		peer->fullcontact[0] = '\0';
 		peer->useragent[0] = '\0';
 		peer->sipoptions = 0;
@@ -13554,6 +13555,7 @@
 
 		/* Schedule re-registration before we expire */
 		r->timeout=ast_sched_add(sched, expires_ms, sip_reregister, r); 
+		registry_unref(r);
 	}
 	return 1;
 }




More information about the asterisk-commits mailing list