[asterisk-commits] mattf: branch mattf/bug13495 r167584 - /team/mattf/bug13495/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 7 16:54:10 CST 2009


Author: mattf
Date: Wed Jan  7 16:54:09 2009
New Revision: 167584

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167584
Log:
Add relevant Asterisk changes to get TCP message passing working for ISUP signaling (ISUP masquerade)

Modified:
    team/mattf/bug13495/channels/chan_dahdi.c

Modified: team/mattf/bug13495/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/mattf/bug13495/channels/chan_dahdi.c?view=diff&rev=167584&r1=167583&r2=167584
==============================================================================
--- team/mattf/bug13495/channels/chan_dahdi.c (original)
+++ team/mattf/bug13495/channels/chan_dahdi.c Wed Jan  7 16:54:09 2009
@@ -1046,9 +1046,21 @@
 
 		for (i = 0; i < slave_chan_server.numslaves; i++) {
 			if (!strcasecmp(ast_inet_ntoa(slave_addr.sin_addr), slave_chan_server.slave_channel[i].addr)) {
+				int flags;
 				struct dahdi_ss7 *ss7 = ss7_resolve_linkset(slave_chan_server.slave_channel[i].linksetnum);
 
-				ast_log(LOG_NOTICE, "Accepting SS7 slave connection from host %s\n", ast_inet_ntoa(slave_addr.sin_addr));
+				ast_log(LOG_NOTICE, "Accepting SS7 slave connection from host %s fd %d\n", ast_inet_ntoa(slave_addr.sin_addr), slave_sock);
+
+				if ((flags = fcntl(slave_sock, F_GETFL)) < 0) {
+					ast_log(LOG_WARNING,"Fcntl(F_GETFL) failed: %s\n", strerror(errno));
+					close(slave_sock);
+					continue;
+				}
+				if (fcntl(slave_sock, F_SETFL, flags | O_NONBLOCK) < 0) {
+					ast_log(LOG_WARNING,"Fnctl(F_SETFL) failed: %s\n", strerror(errno));
+					close(slave_sock);
+					continue;
+				}
 
 				ast_mutex_lock(&ss7->lock);
 
@@ -1059,6 +1071,9 @@
 
 				ss7->fds[ss7->numsigchans++] = slave_sock;
 				/* XXX */
+				if (ss7->master != AST_PTHREADT_NULL)
+					pthread_kill(ss7->master, SIGURG);
+
 				ast_mutex_unlock(&ss7->lock);
 				goto do_accept;
 			}
@@ -10407,6 +10422,7 @@
 				int x;
 				if (ioctl(pollers[i].fd, DAHDI_GETEVENT, &x)) {
 					ast_log(LOG_ERROR, "Error in exception retrieval!\n");
+					continue;
 				}
 				switch (x) {
 				case DAHDI_EVENT_OVERRUN:




More information about the asterisk-commits mailing list