Skip to content

Commit

Permalink
Merge pull request #9482 from Robyt3/Client-Dummy-Redirect-Reconnect
Browse files Browse the repository at this point in the history
Support reconnecting dummy by redirecting to same port
  • Loading branch information
heinrich5991 authored Jan 5, 2025
2 parents 43524b9 + 2cba565 commit 5ba3b1d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,11 +1768,26 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
{
return;
}
char aAddr[NETADDR_MAXSTRSIZE];
NETADDR ServerAddr = ServerAddress();
ServerAddr.port = RedirectPort;
net_addr_str(&ServerAddr, aAddr, sizeof(aAddr), true);
Connect(aAddr);
if(Conn == CONN_MAIN)
{
NETADDR ServerAddr = ServerAddress();
ServerAddr.port = RedirectPort;
char aAddr[NETADDR_MAXSTRSIZE];
net_addr_str(&ServerAddr, aAddr, sizeof(aAddr), true);
Connect(aAddr);
}
else
{
DummyDisconnect(nullptr);
if(ServerAddress().port != RedirectPort)
{
// Only allow redirecting to the same port to reconnect. The dummy
// should not be connected to a different server than the main, as
// the client assumes that main and dummy use the same map.
return;
}
DummyConnect();
}
}
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_ADD)
{
Expand Down

0 comments on commit 5ba3b1d

Please sign in to comment.