[asterisk-commits] russell: branch bbryant/sip-tcptls r73761 - /team/bbryant/sip-tcptls/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 6 14:45:14 CDT 2007


Author: russell
Date: Fri Jul  6 14:45:13 2007
New Revision: 73761

URL: http://svn.digium.com/view/asterisk?view=rev&rev=73761
Log:
* Reformat a function to reduce some indentation
* Fix setting default socket info for a peer

Modified:
    team/bbryant/sip-tcptls/channels/chan_sip.c

Modified: team/bbryant/sip-tcptls/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/sip-tcptls/channels/chan_sip.c?view=diff&rev=73761&r1=73760&r2=73761
==============================================================================
--- team/bbryant/sip-tcptls/channels/chan_sip.c (original)
+++ team/bbryant/sip-tcptls/channels/chan_sip.c Fri Jul  6 14:45:13 2007
@@ -16112,33 +16112,32 @@
 static void sip_prepare_socket(struct sip_pvt *p) 
 {
 	struct sip_socket *s = &p->socket;
+	char name[] = "SIP socket";
+	struct server_args ca;
 
 	if (s->fd != -1)
 		return;
 
-	if (!(s->type & SIP_TRANSPORT_UDP)) {
-		char name[] = "SIP socket";
-		struct server_args ca;
-
-		ca.name = name;
-		ca.accept_fd = -1;
-		ca.tls_cfg = (s->ser) ? s->ser->parent->tls_cfg : NULL;
-		ca.sin = *(sip_real_dst(p));
-		s->ser = (!s->ser) ? client_start(&ca) : s->ser;
-
-		if (!s->ser)
-			return;
-
-		s->fd = ca.accept_fd;
-
-		if (ast_pthread_create_background(&ca.master, NULL, sip_tcp_helper_thread, p)) {
-			ast_log(LOG_DEBUG, "Unable to launch '%s'.", ca.name);
-			close(ca.accept_fd);
-			s->fd = ca.accept_fd = -1;
-			return;
-		}
-	} else {
+	if (s->type & SIP_TRANSPORT_UDP) {
 		s->fd = sipsock;
+		return;
+	}
+
+	ca.name = name;
+	ca.accept_fd = -1;
+	ca.tls_cfg = (s->ser) ? s->ser->parent->tls_cfg : NULL;
+	ca.sin = *(sip_real_dst(p));
+	s->ser = (!s->ser) ? client_start(&ca) : s->ser;
+
+	if (!s->ser)
+		return;
+
+	s->fd = ca.accept_fd;
+
+	if (ast_pthread_create_background(&ca.master, NULL, sip_tcp_helper_thread, p)) {
+		ast_log(LOG_DEBUG, "Unable to launch '%s'.", ca.name);
+		close(ca.accept_fd);
+		s->fd = ca.accept_fd = -1;
 	}
 }
 
@@ -17109,6 +17108,8 @@
 	peer->pickupgroup = 0;
 	peer->maxms = default_qualify;
 	peer->prefs = default_prefs;
+	peer->socket.type = SIP_TRANSPORT_UDP;
+	peer->socket.fd = -1;
 }
 
 /*! \brief Create temporary peer (used in autocreatepeer mode) */




More information about the asterisk-commits mailing list