From 3ea862c850a4e8a98359fc4667c8e2012e414766 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Mon, 4 Nov 2024 08:05:43 +0800 Subject: [PATCH] Send password on reconnect Closed #9201 --- src/engine/client/client.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index fa1bcc6f8..607d652ea 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -540,6 +540,9 @@ void CClient::Connect(const char *pAddress, const char *pPassword) Disconnect(); dbg_assert(m_State == IClient::STATE_OFFLINE, "Disconnect must ensure that client is offline"); + char aLastAddr[NETADDR_MAXSTRSIZE]; + net_addr_str(&ServerAddress(), aLastAddr, sizeof(aLastAddr), true); + if(pAddress != m_aConnectAddressStr) str_copy(m_aConnectAddressStr, pAddress); @@ -583,6 +586,12 @@ void CClient::Connect(const char *pAddress, const char *pPassword) OnlySixup = false; net_addr_str(&NextAddr, aNextAddr, sizeof(aNextAddr), true); log_debug("client", "resolved connect address '%s' to %s", aBuffer, aNextAddr); + + if(!str_comp(aNextAddr, aLastAddr)) + { + m_SendPassword = true; + } + aConnectAddrs[NumConnectAddrs] = NextAddr; NumConnectAddrs += 1; }