aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs/Sockets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CommonLibs/Sockets.cpp')
-rw-r--r--CommonLibs/Sockets.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/CommonLibs/Sockets.cpp b/CommonLibs/Sockets.cpp
index dc110c8..dd7527c 100644
--- a/CommonLibs/Sockets.cpp
+++ b/CommonLibs/Sockets.cpp
@@ -41,6 +41,10 @@
#include <stdlib.h>
+
+
+
+
bool resolveAddress(struct sockaddr_in *address, const char *hostAndPort)
{
assert(address);
@@ -255,6 +259,11 @@ void UDPSocket::open(unsigned short localPort)
throw SocketError();
}
+ // pat added: This lets the socket be reused immediately, which is needed if OpenBTS crashes.
+ int on = 1;
+ setsockopt(mSocketFD, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+
// bind
struct sockaddr_in address;
size_t length = sizeof(address);