fix(world): send players to the new chat server again on the next connect

A world that still thinks it is connected when CHAT_SERVER_READY arrives sends
its players at once; should that link be the retired chat server's, not yet
noticed as gone, they are sent again once the world reconnects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-28 15:06:35 -05:00
parent ffcf01e43b
commit 5a9dafe6f7

View File

@@ -170,12 +170,14 @@ void ResendPlayersToChat() {
// CHAT_SERVER_READY (live update): connect to the new chat server now rather than at the next retry
void OnChatServerReady() {
g_ChatResyncPending = true;
if (g_ChatConnected) {
g_ChatResyncPending = false;
// Already connected to the new one; should that be the old one's link and not noticed yet, the players go
// again once connected (a resync changes nothing for players the chat server has)
ResendPlayersToChat();
g_ChatResyncPending = true;
return;
}
g_ChatResyncPending = true;
LOG("A new chat server is up; connecting");
Game::chatServer->Connect(g_ChatIP.c_str(), g_ChatPort, NET_PASSWORD_EXTERNAL, strnlen(NET_PASSWORD_EXTERNAL, sizeof(NET_PASSWORD_EXTERNAL)));
}