[Asterisk-cvs] asterisk/channels chan_iax2.c,1.320,1.321
kpfleming at lists.digium.com
kpfleming at lists.digium.com
Tue Jul 19 19:09:42 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv19368/channels
Modified Files:
chan_iax2.c
Log Message:
split acl and netsock code into separate files, in preparation for new netsock implementation
various minor cleanups
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- chan_iax2.c 15 Jul 2005 23:00:46 -0000 1.320
+++ chan_iax2.c 19 Jul 2005 23:17:02 -0000 1.321
@@ -43,6 +43,7 @@
#include "asterisk/aes.h"
#include "asterisk/dnsmgr.h"
#include "asterisk/devicestate.h"
+#include "asterisk/netsock.h"
#include <sys/mman.h>
#include <arpa/inet.h>
@@ -156,7 +157,7 @@
static int timingfd = -1; /* Timing file descriptor */
-static struct ast_netsock_list netsock;
+static struct ast_netsock_list *netsock;
static int defaultsockfd = -1;
static int usecnt;
@@ -7864,7 +7865,7 @@
if (res == 0) {
/* ip address valid. */
sin.sin_port = htons(port);
- sock = ast_netsock_find(&netsock, &sin);
+ sock = ast_netsock_find(netsock, &sin);
if (sock) {
sockfd = ast_netsock_sockfd(sock);
nonlocal = 0;
@@ -8423,7 +8424,7 @@
if (reload) {
ast_log(LOG_NOTICE, "Ignoring bindaddr on reload\n");
} else {
- if (!(ns = ast_netsock_bind(&netsock, io, v->value, portno, tos, socket_read, NULL))) {
+ if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, tos, socket_read, NULL))) {
ast_log(LOG_WARNING, "Unable apply binding to '%s' at line %d\n", v->value, v->lineno);
} else {
if (option_verbose > 1) {
@@ -9247,7 +9248,7 @@
pthread_cancel(netthreadid);
pthread_join(netthreadid, NULL);
}
- ast_netsock_release(&netsock);
+ ast_netsock_release(netsock);
for (x=0;x<IAX_MAX_CALLS;x++)
if (iaxs[x])
iax2_destroy(x);
@@ -9318,13 +9319,18 @@
return -1;
}
+ netsock = ast_netsock_list_alloc();
+ if (!netsock) {
+ ast_log(LOG_ERROR, "Could not allocate netsock list.\n");
+ return -1;
+ }
+ ast_netsock_init(netsock);
+
ast_mutex_init(&iaxq.lock);
ast_mutex_init(&userl.lock);
ast_mutex_init(&peerl.lock);
ast_mutex_init(&waresl.lock);
- ast_netsock_init(&netsock);
-
ast_cli_register_multiple(iax2_cli, sizeof(iax2_cli) / sizeof(iax2_cli[0]));
ast_register_application(papp, iax2_prov_app, psyn, pdescrip);
@@ -9344,7 +9350,7 @@
ast_log(LOG_ERROR, "Unable to register IAX switch\n");
if (defaultsockfd < 0) {
- if (!(ns = ast_netsock_bindaddr(&netsock, io, &sin, tos, socket_read, NULL))) {
+ if (!(ns = ast_netsock_bindaddr(netsock, io, &sin, tos, socket_read, NULL))) {
ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno));
return -1;
} else {
@@ -9360,7 +9366,7 @@
ast_verbose(VERBOSE_PREFIX_2 "IAX Ready and Listening\n");
} else {
ast_log(LOG_ERROR, "Unable to start network thread\n");
- ast_netsock_release(&netsock);
+ ast_netsock_release(netsock);
}
for (reg = registrations; reg; reg = reg->next)
More information about the svn-commits
mailing list