[asterisk-commits] russell: branch 1.4 r59654 - in /branches/1.4:
./ main/netsock.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Apr 2 08:39:07 MST 2007
Author: russell
Date: Mon Apr 2 10:39:07 2007
New Revision: 59654
URL: http://svn.digium.com/view/asterisk?view=rev&rev=59654
Log:
Merged revisions 59608 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r59608 | russell | 2007-04-01 17:35:25 -0500 (Sun, 01 Apr 2007) | 6 lines
Add the SO_REUSEADDR flag to sockets handled by netsock. This is needed by
the patch that went in for issue 7874. chan_iax2 needs to be able to create
socket that is lisetning on INADDR_ANY, but also be able to bind sockets to
specific addresses. (Thanks to Stevenson on the asterisk-dev mailing list
for explaining why this flag was needed.)
........
Modified:
branches/1.4/ (props changed)
branches/1.4/main/netsock.c
Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: branches/1.4/main/netsock.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/netsock.c?view=diff&rev=59654&r1=59653&r2=59654
==============================================================================
--- branches/1.4/main/netsock.c (original)
+++ branches/1.4/main/netsock.c Mon Apr 2 10:39:07 2007
@@ -125,6 +125,7 @@
int *ioref;
struct ast_netsock *ns;
+ const int reuseFlag = 1;
/* Make a UDP socket */
netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
@@ -132,6 +133,9 @@
if (netsocket < 0) {
ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno));
return NULL;
+ }
+ if (setsockopt(netsocket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseFlag, sizeof reuseFlag) < 0) {
+ ast_log(LOG_WARNING, "Error setting SO_REUSEADDR on sockfd '%d'\n", netsocket);
}
if (bind(netsocket,(struct sockaddr *)bindaddr, sizeof(struct sockaddr_in))) {
ast_log(LOG_ERROR, "Unable to bind to %s port %d: %s\n", ast_inet_ntoa(bindaddr->sin_addr), ntohs(bindaddr->sin_port), strerror(errno));
More information about the asterisk-commits
mailing list