In recent FB versions Classic on Linux uses its native listener instead of xinetd/systemd. While we usually don't expect it to crash, it's still possible. However, often it cannot continue listening the port immediately after restart because the port is still in the FIN_WAIT state and the SO_REUSEADDR socket option is not used by the standalone Classic listener, thus causing "address already in use" errors during startup. This patch ensures that any kind of listeners (SS/SC using SRVR_multi_thread and CS standalone server) uses the SO_REUSEADDR option to avoid the issue.
Maybe (after this patch) we should also cleanup the retry loop for INET_ADDR_IN_USE used later in this function, as it's likely to be pointless, but I leave it for another day.
In recent FB versions Classic on Linux uses its native listener instead of xinetd/systemd. While we usually don't expect it to crash, it's still possible. However, often it cannot continue listening the port immediately after restart because the port is still in the
FIN_WAIT
state and theSO_REUSEADDR
socket option is not used by the standalone Classic listener, thus causing "address already in use" errors during startup. This patch ensures that any kind of listeners (SS/SC usingSRVR_multi_thread
and CS standalone server) uses theSO_REUSEADDR
option to avoid the issue.Maybe (after this patch) we should also cleanup the retry loop for
INET_ADDR_IN_USE
used later in this function, as it's likely to be pointless, but I leave it for another day.