summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/ServerHandleImpl.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-02-07 18:39:24 +0100
committerHowaner <franzi.moos@googlemail.com>2015-02-07 18:39:24 +0100
commitbe528a9f527e631181b590346d77eaaf64c914cd (patch)
treee149c4c348ce51346a7e1f29ed97efcb9347c5f5 /src/OSSupport/ServerHandleImpl.cpp
parentSet reuse flag to sockets (diff)
downloadcuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar.gz
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar.bz2
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar.lz
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar.xz
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.tar.zst
cuberite-be528a9f527e631181b590346d77eaaf64c914cd.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/ServerHandleImpl.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp
index a3a08e84f..6f4343b1f 100644
--- a/src/OSSupport/ServerHandleImpl.cpp
+++ b/src/OSSupport/ServerHandleImpl.cpp
@@ -127,14 +127,9 @@ bool cServerHandleImpl::Listen(UInt16 a_Port)
evutil_socket_t MainSock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
// Set reuse flag
- {
- #if defined(_WIN32) || defined(ANDROID_NDK)
- char yes = 1;
- #else
- int yes = 1;
- #endif
- setsockopt(MainSock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
- }
+ #if !defined(_WIN32)
+ evutil_make_listen_socket_reuseable(MainSock);
+ #endif
if (!IsValidSocket(MainSock))
{
@@ -215,14 +210,9 @@ bool cServerHandleImpl::Listen(UInt16 a_Port)
evutil_socket_t SecondSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
// Set reuse flag
- {
- #if defined(_WIN32) || defined(ANDROID_NDK)
- char yes = 1;
- #else
- int yes = 1;
- #endif
- setsockopt(SecondSock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
- }
+ #if !defined(_WIN32)
+ evutil_make_listen_socket_reuseable(SecondSock);
+ #endif
if (!IsValidSocket(SecondSock))
{