In our Redis Replication extension, during stage N, the user's code initiates a TCPListener that binds to a specific HOST:PORT. Shortly after, within a few seconds upon progressing to stage N+1, our system attempts to start another TCPListener bound to the identical HOST:PORT. To ensure seamless operation and prevent test failures in this scenario, it's essential to enable the SO_REUSEADDR option on both Listeners. Without activating SO_REUSEADDR, the system will block any attempts to bind a new socket to the same HOST:PORT for a duration of 30 seconds, when it is in TIME_WAIT stage.
In our Redis Replication extension, during stage N, the user's code initiates a
TCPListener
that binds to a specificHOST:PORT
. Shortly after, within a few seconds upon progressing to stage N+1, our system attempts to start anotherTCPListener
bound to the identicalHOST:PORT
. To ensure seamless operation and prevent test failures in this scenario, it's essential to enable theSO_REUSEADDR
option on both Listeners. Without activatingSO_REUSEADDR
, the system will block any attempts to bind a new socket to the sameHOST:PORT
for a duration of 30 seconds, when it is inTIME_WAIT
stage.Fixes : https://github.com/codecrafters-io/build-your-own-redis/issues/125