mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
fix xml_rpc socket shutdown
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9796 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -42,12 +42,12 @@ ServerTerminate(TServer * const serverP) {
|
||||
|
||||
srvP->terminationRequested = true;
|
||||
|
||||
if (srvP->chanSwitchP)
|
||||
if (srvP->chanSwitchP) {
|
||||
ChanSwitchInterrupt(srvP->chanSwitchP);
|
||||
ChanSwitchDestroy(srvP->chanSwitchP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
ServerResetTerminate(TServer * const serverP) {
|
||||
|
||||
@@ -651,7 +651,7 @@ createChanSwitch(struct _TServer * const srvP,
|
||||
|
||||
|
||||
|
||||
void
|
||||
int
|
||||
ServerInit(TServer * const serverP) {
|
||||
/*----------------------------------------------------------------------------
|
||||
Initialize a server to accept connections.
|
||||
@@ -700,9 +700,11 @@ ServerInit(TServer * const serverP) {
|
||||
}
|
||||
if (retError) {
|
||||
TraceMsg("ServerInit() failed. %s", retError);
|
||||
exit(1);
|
||||
return 0;
|
||||
xmlrpc_strfree(retError);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "socket_unix.h"
|
||||
|
||||
#define sane_close(_it) if (_it > -1) {close(_it) ; _it = -1; }
|
||||
#define sane_close(_it) do {if (_it > -1) { close(_it) ; _it = -1; }} while (_it > -1)
|
||||
|
||||
typedef struct {
|
||||
int interruptorFd;
|
||||
@@ -849,6 +849,7 @@ bindSocketToPort(int const fd,
|
||||
|
||||
struct sockaddr_in name;
|
||||
int rc;
|
||||
int one = 1;
|
||||
|
||||
name.sin_family = AF_INET;
|
||||
name.sin_port = htons(portNumber);
|
||||
@@ -857,6 +858,7 @@ bindSocketToPort(int const fd,
|
||||
else
|
||||
name.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int));
|
||||
rc = bind(fd, (struct sockaddr *)&name, sizeof(name));
|
||||
|
||||
if (rc == -1)
|
||||
|
@@ -838,6 +838,7 @@ bindSocketToPort(SOCKET const winsock,
|
||||
|
||||
struct sockaddr_in name;
|
||||
int rc;
|
||||
int one = 1;
|
||||
|
||||
ZeroMemory(&name, sizeof(name));
|
||||
name.sin_family = AF_INET;
|
||||
@@ -845,6 +846,7 @@ bindSocketToPort(SOCKET const winsock,
|
||||
if (addrP)
|
||||
name.sin_addr = *addrP;
|
||||
|
||||
setsockopt(winsock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int));
|
||||
rc = bind(winsock, (struct sockaddr *)&name, sizeof(name));
|
||||
|
||||
if (rc != 0) {
|
||||
|
Reference in New Issue
Block a user