fix(Apps/SOAP): avoid bind crash on quick restart (#26325)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-06-24 03:06:21 -05:00
committed by GitHub
parent 8f6de287c8
commit 661dd71f73
@@ -33,10 +33,15 @@ void ACSoapThread(const std::string& host, uint16 port)
soap.recv_timeout = 5;
soap.send_timeout = 5;
// allow rebinding while the previous socket is still in TIME_WAIT (e.g. on a quick restart)
soap.bind_flags = SO_REUSEADDR;
if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100)))
{
LOG_ERROR("network.soap", "ACSoap: couldn't bind to {}:{}", host, port);
exit(-1);
// graceful shutdown: exit() here would destroy SocketMgr before StopNetwork() and assert
World::StopNow(ERROR_EXIT_CODE);
return;
}
LOG_INFO("network.soap", "ACSoap: bound to http://{}:{}", host, port);