Skip to content

Commit

Permalink
Use evutil_make_listen_socket_reuseable
Browse files Browse the repository at this point in the history
  • Loading branch information
Howaner committed Feb 7, 2015
1 parent d32831d commit be528a9
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/OSSupport/ServerHandleImpl.cpp
Expand Up @@ -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);

This comment has been minimized.

Copy link
@worktycho

worktycho Feb 8, 2015

Member

CID 104670. This needs to happen after the check for whether MainSock is valid.

This comment has been minimized.

Copy link
@madmaxoft

madmaxoft Feb 8, 2015

Member

Fixed.

#endif

if (!IsValidSocket(MainSock))
{
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit be528a9

Please sign in to comment.