From 661dd71f735a23d551b46889f3423a0c89c23406 Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Wed, 24 Jun 2026 03:06:21 -0500 Subject: [PATCH] fix(Apps/SOAP): avoid bind crash on quick restart (#26325) Co-authored-by: blinkysc --- src/server/apps/worldserver/ACSoap/ACSoap.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/apps/worldserver/ACSoap/ACSoap.cpp b/src/server/apps/worldserver/ACSoap/ACSoap.cpp index 247f6bb95..dfd3d07a2 100644 --- a/src/server/apps/worldserver/ACSoap/ACSoap.cpp +++ b/src/server/apps/worldserver/ACSoap/ACSoap.cpp @@ -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);