Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpersaud committed Sep 18, 2024
1 parent aa03fd6 commit 671bc6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1803,11 +1803,13 @@ int S_socket(const string& host, bool isTCP, bool isPort, bool isBlocking) {

// If this is a port, bind
if (isPort) {
// Enable port reuse (so we don't have TIME_WAIT binding issues) and
// Enable address reuse so that we can startup a new process while the old one is shutting down
// and to handle connections left in TCP TIME_WAIT state
u_long enable = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&enable, sizeof(enable)))
STHROW("couldn't set REUSEADDR");

// Enable port reuse as well for the same reason as the above
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, (char*)&enable, sizeof(enable)))
STHROW("couldn't set REUSEPORT");

Expand Down

0 comments on commit 671bc6e

Please sign in to comment.