[asterisk-commits] russell: branch russell/sched_thread r140404 - /team/russell/sched_thread/cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 28 17:10:29 CDT 2008


Author: russell
Date: Thu Aug 28 17:10:28 2008
New Revision: 140404

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140404
Log:
a bit more conversion ...

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

Modified: team/russell/sched_thread/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/sched_thread/channels/chan_sip.c?view=diff&rev=140404&r1=140403&r2=140404
==============================================================================
--- team/russell/sched_thread/channels/chan_sip.c (original)
+++ team/russell/sched_thread/channels/chan_sip.c Thu Aug 28 17:10:28 2008
@@ -9720,16 +9720,19 @@
 			p = dialog_unref(p, "unref dialog after unlink_all");
 			if (r->timeout > -1) {
 				if (sched_thread_del(sched, r->timeout) > -1) {
-					registry_unref(_data, "del for REPLACE of registry ptr"), 
+					registry_unref(r, "del for REPLACE of registry ptr");
 				}
 				r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, 
 						registry_addref(r, "add"));
 				if (r->timeout == -1) {
-					registry_unref(_data, "sched_add failed"), 
+					registry_unref(r, "sched_add failed");
 				}
 				ast_log(LOG_WARNING, "Still have a registration timeout for %s@%s (create_addr() error), %d\n", r->username, r->hostname, r->timeout);
 			} else {
-				r->timeout = ast_sched_add(sched, global_reg_timeout * 1000, sip_reg_timeout, registry_addref(r, "add for REPLACE registry ptr"));
+				r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, registry_addref(r, "add for REPLACE registry ptr"));
+				if (r->timeout == -1) {
+					registry_unref(r, "add failed");
+				}
 				ast_log(LOG_WARNING, "Probably a DNS error for registration to %s@%s, trying REGISTER again (after %d seconds)\n", r->username, r->hostname, global_reg_timeout);
 			}
 			r->regattempts++;
@@ -9784,10 +9787,14 @@
 	if (auth == NULL)  {
 		if (r->timeout > -1)
 			ast_log(LOG_WARNING, "Still have a registration timeout, #%d - deleting it\n", r->timeout);
-		AST_SCHED_REPLACE_UNREF(r->timeout, sched, global_reg_timeout * 1000, sip_reg_timeout, r,
-								registry_unref(_data,"reg ptr unrefed from del in SCHED_REPLACE"),
-								registry_unref(r,"reg ptr unrefed from add failure in SCHED_REPLACE"),
-								registry_addref(r,"reg ptr reffed from add in SCHED_REPLACE"));
+		if (!sched_thread_del(sched, r->timeout)) {
+			registry_unref(r, "");
+		}
+		r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout,
+				registry_addref(r, ""));
+		if (r->timeout == -1) {
+			registry_unref(r, "");
+		}
 		ast_debug(1, "Scheduled a registration timeout for %s id  #%d \n", r->hostname, r->timeout);
 	}
 
@@ -10176,7 +10183,8 @@
 	peer->addr.sin_port = htons(port);
 	if (sipsock < 0) {
 		/* SIP isn't up yet, so schedule a poke only, pretty soon */
-		AST_SCHED_REPLACE(peer->pokeexpire, sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
+		sched_thread_del(sched, peer->pokeexpire);
+		peer->pokeexpire = sched_thread_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
 	} else {
 		sip_poke_peer(peer, 0);
 	}




More information about the asterisk-commits mailing list