[asterisk-commits] mattf: branch mattf/bug13495 r170942 - /team/mattf/bug13495/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jan 24 17:46:24 CST 2009
Author: mattf
Date: Sat Jan 24 17:46:23 2009
New Revision: 170942
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=170942
Log:
Change server code so that we allocate all space for slave sockets up front, and activate them when clients connect
Modified:
team/mattf/bug13495/channels/chan_dahdi.c
Modified: team/mattf/bug13495/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/mattf/bug13495/channels/chan_dahdi.c?view=diff&rev=170942&r1=170941&r2=170942
==============================================================================
--- team/mattf/bug13495/channels/chan_dahdi.c (original)
+++ team/mattf/bug13495/channels/chan_dahdi.c Sat Jan 24 17:46:23 2009
@@ -1075,15 +1075,20 @@
ast_mutex_lock(&ss7->lock);
- isup_masquerade_set_route_fd(ss7->ss7, slave_sock,
- slave_chan_server.slave_channel[i].startcic,
- slave_chan_server.slave_channel[i].endcic,
- slave_chan_server.slave_channel[i].opc);
-
- ss7->fds[ss7->numsigchans++] = slave_sock;
- /* XXX */
- if (ss7->master != AST_PTHREADT_NULL)
- pthread_kill(ss7->master, SIGURG);
+ for (i = 0; i < ss7->numsigchans; i++) {
+ if (!strcasecmp(ss7->sigchans[i], "slave") && (ss7->fds[i] == -1)) {
+ isup_masquerade_set_route_fd(ss7->ss7, slave_sock,
+ slave_chan_server.slave_channel[i].startcic,
+ slave_chan_server.slave_channel[i].endcic,
+ slave_chan_server.slave_channel[i].opc);
+
+ ss7->fds[i] = slave_sock;
+ /* XXX */
+ if (ss7->master != AST_PTHREADT_NULL)
+ pthread_kill(ss7->master, SIGURG);
+ break;
+ }
+ }
ast_mutex_unlock(&ss7->lock);
goto do_accept;
@@ -1140,6 +1145,10 @@
slave_chan_server.slave_channel[slave_chan_server.numslaves].opc);
slave_chan_server.numslaves++;
+
+ ss7->fds[ss7->numsigchans] = -1;
+ sprintf(ss7->sigchans[ss7->numsigchans], "slave");
+ ss7->numsigchans++;
return;
}
@@ -10594,15 +10603,18 @@
ast_log(LOG_WARNING, "MTP2 link down\n");
for (i = 0; i < linkset->numsigchans; i++) {
if (linkset->fds[i] == e->gen.data) {
- /* Verify that it's a TCP fd */
- if (strcasecmp("tcp", linkset->sigchans[i])) {
- break;
+ if (!strcasecmp(linkset->sigchans[i], "slave") ||
+ !strncasecmp("tcp", linkset->sigchans[i], 3)) {
+
+ close(linkset->fds[i]);
+ linkset->fds[i] = -1;
+
+ /* The server connections are respawned only by the clients */
+ if (!strcasecmp(linkset->sigchans[i], "slave"))
+ break;
+
+ ss7_start_tcp_channel(linkset, i);
}
-
- close(linkset->fds[i]);
- linkset->fds[i] = -1;
-
- ss7_start_tcp_channel(linkset, i);
}
}
break;
More information about the asterisk-commits
mailing list