[svn-commits] file: branch group/sip-object-matching r178069 - /team/group/sip-object-match...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 23 13:13:26 CST 2009


Author: file
Date: Mon Feb 23 13:13:25 2009
New Revision: 178069

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178069
Log:
Use the right structure when seeing what type things are and do an audit of all the places that actually just want to get a peer.

Modified:
    team/group/sip-object-matching/channels/chan_sip.c

Modified: team/group/sip-object-matching/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/sip-object-matching/channels/chan_sip.c?view=diff&rev=178069&r1=178068&r2=178069
==============================================================================
--- team/group/sip-object-matching/channels/chan_sip.c (original)
+++ team/group/sip-object-matching/channels/chan_sip.c Mon Feb 23 13:13:25 2009
@@ -4520,12 +4520,12 @@
 
 	switch (*which_objects) {
 	case FINDUSERS:
-		if (!(match->type & SIP_TYPE_USER)) {
+		if (!(search->type & SIP_TYPE_USER)) {
 			return 0;
 		}
 		break;
 	case FINDPEERS:
-		if (!(match->type & SIP_TYPE_PEER)) {
+		if (!(search->type & SIP_TYPE_PEER)) {
 			return 0;
 		}
 		break;
@@ -4851,7 +4851,7 @@
 	dialog->sa.sin_family = AF_INET;
 	dialog->timer_t1 = global_t1; /* Default SIP retransmission timer T1 (RFC 3261) */
 	dialog->timer_b = global_timer_b; /* Default SIP transaction timer B (RFC 3261) */
-	peer = find_peer(peername, NULL, TRUE, FINDALLDEVICES, FALSE);
+	peer = find_peer(peername, NULL, TRUE, FINDPEERS, FALSE);
 
 	if (peer) {
 		int res;
@@ -12900,7 +12900,7 @@
 
 		/* Then find devices based on IP */
 		if (!peer) {
-			peer = find_peer(NULL, &p->recv, TRUE, FINDALLDEVICES, FALSE);
+			peer = find_peer(NULL, &p->recv, TRUE, FINDPEERS, FALSE);
 		}
 	}
 
@@ -14238,7 +14238,7 @@
 		return CLI_SHOWUSAGE;
 
 	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
-	if ((peer = find_peer(argv[3], NULL, load_realtime, FINDALLDEVICES, FALSE))) {
+	if ((peer = find_peer(argv[3], NULL, load_realtime, FINDPEERS, FALSE))) {
 		sip_poke_peer(peer, 1);
 		unref_peer(peer, "qualify: done with peer");
 	} else if (type == 0) {
@@ -14320,11 +14320,7 @@
 		return CLI_SHOWUSAGE;
 
 	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
-	peer = find_peer(argv[3], NULL, load_realtime, FINDALLDEVICES, FALSE);
-
-	if (!(peer->type & SIP_TYPE_PEER)) {
-		peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer");
-	}
+	peer = find_peer(argv[3], NULL, load_realtime, FINDPEERS, FALSE);
 
 	if (s) { 	/* Manager */
 		if (peer) {
@@ -14607,7 +14603,7 @@
 	/* Load from realtime storage? */
 	load_realtime = (a->argc == 5 && !strcmp(a->argv[4], "load")) ? TRUE : FALSE;
 
-	if ((user = find_peer(a->argv[3], NULL, load_realtime, TRUE, FALSE))) {
+	if ((user = find_peer(a->argv[3], NULL, load_realtime, FINDUSERS, FALSE))) {
 		ao2_lock(user);
 		ast_cli(a->fd, "\n\n");
 		ast_cli(a->fd, "  * Name       : %s\n", user->name);
@@ -14765,7 +14761,7 @@
 	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 	
-	if ((peer = find_peer(a->argv[2], NULL, load_realtime, FINDALLDEVICES, TRUE))) {
+	if ((peer = find_peer(a->argv[2], NULL, load_realtime, FINDPEERS, TRUE))) {
 		if (peer->expire > 0) {
 			expire_register(ref_peer(peer, "ref for expire_register"));
 			ast_cli(a->fd, "Unregistered peer \'%s\'\n\n", a->argv[2]);
@@ -15775,7 +15771,7 @@
 /*! \brief  Turn on SIP debugging for a given peer */
 static char *sip_do_debug_peer(int fd, char *arg)
 {
-	struct sip_peer *peer = find_peer(arg, NULL, TRUE, FINDALLDEVICES, FALSE);
+	struct sip_peer *peer = find_peer(arg, NULL, TRUE, FINDPEERS, FALSE);
 	if (!peer)
 		ast_cli(fd, "No such peer '%s'\n", arg);
 	else if (peer->addr.sin_addr.s_addr == 0)
@@ -16230,7 +16226,7 @@
 	else
 		colname = "ip";
 
-	if (!(peer = find_peer(data, NULL, TRUE, FINDALLDEVICES, FALSE)))
+	if (!(peer = find_peer(data, NULL, TRUE, FINDPEERS, FALSE)))
 		return -1;
 
 	if (!strcasecmp(colname, "ip")) {
@@ -21586,7 +21582,7 @@
 		if (p->stimer->st_cached_max_se) {
 			return p->stimer->st_cached_max_se;
 		} else if (p->peername) {
-			struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDALLDEVICES, FALSE);
+			struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE);
 			if (pp) {
 				p->stimer->st_cached_max_se = pp->stimer.st_max_se;
 				unref_peer(pp, "unref peer pointer from find_peer call in st_get_se");
@@ -21599,7 +21595,7 @@
 		if (p->stimer->st_cached_min_se) {
 			return p->stimer->st_cached_min_se;
 		} else if (p->peername) {
-			struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDALLDEVICES, FALSE);
+			struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE);
 			if (pp) {
 				p->stimer->st_cached_min_se = pp->stimer.st_min_se;
 				unref_peer(pp, "unref peer pointer from find_peer call in st_get_se (2)");
@@ -21621,7 +21617,7 @@
 		return p->stimer->st_cached_ref;
 
 	if (p->peername) {
-		struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDALLDEVICES, FALSE);
+		struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE);
 		if (pp) {
 			p->stimer->st_cached_ref = pp->stimer.st_ref;
 			unref_peer(pp, "unref peer pointer from find_peer call in st_get_refresher");
@@ -21646,7 +21642,7 @@
 		return p->stimer->st_cached_mode;
 
 	if (p->peername) {
-		struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDALLDEVICES, FALSE);
+		struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE);
 		if (pp) {
 			p->stimer->st_cached_mode = pp->stimer.st_mode_oper;
 			unref_peer(pp, "unref peer pointer from find_peer call in st_get_mode");




More information about the svn-commits mailing list