Skip to content

Commit

Permalink
TcpSocket#Bind(): also set SO_REUSEPORT
Browse files Browse the repository at this point in the history
refs #6898

(cherry picked from commit 984f7be)
  • Loading branch information
Al2Klimov authored and Michael Friedrich committed Feb 11, 2019
1 parent f6a62e7 commit 362c7eb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/base/tcpsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ void TcpSocket::Bind(const String& node, const String& service, int family)

const int optTrue = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
#ifndef _WIN32
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
#endif /* _WIN32 */

int rc = bind(fd, info->ai_addr, info->ai_addrlen);

Expand Down

0 comments on commit 362c7eb

Please sign in to comment.