Fix(net): SO_REUSEADDR sur l acceptor (durcissement anti bind-fail TIME_WAIT)
AsyncAcceptor::Bind() pose desormais SO_REUSEADDR entre open() et bind()
(aligne upstream TC) : permet le rebind immediat d un port encore en
TIME_WAIT apres un kill/crash brutal avec connexions actives, evitant le
"Could not bind ... Address already in use" au redemarrage. Complete le fix
StopNetwork (17845330) qui supprime deja le crash a l extinction.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,12 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SO_REUSEADDR : autorise le rebind immediat d un port encore en TIME_WAIT
|
||||||
|
// (evite "Address already in use" / bind-fail au redemarrage rapide).
|
||||||
|
_acceptor.set_option(boost::asio::socket_base::reuse_address(true), errorCode);
|
||||||
|
if (errorCode)
|
||||||
|
TC_LOG_INFO("network", "Failed to set SO_REUSEADDR on acceptor %s", errorCode.message().c_str());
|
||||||
|
|
||||||
_acceptor.bind(_endpoint, errorCode);
|
_acceptor.bind(_endpoint, errorCode);
|
||||||
if (errorCode)
|
if (errorCode)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user