Fix inconsistent client state after disconnecting with network error

The `Disconnect` function did not fully clear all server data, because the client state was already set to offline manually before the function is called. This was causing inconsistent behavior when connecting to another server after being disconnected. For example, the client could get stuck at "getting game info" when connecting the next time.
This commit is contained in:
Robert Müller 2023-04-08 13:58:59 +02:00
parent 22c6e7ebeb
commit aa95f61f11

View file

@ -2524,7 +2524,6 @@ void CClient::PumpNetwork()
// check for errors
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITTING && m_aNetClient[CONN_MAIN].State() == NETSTATE_OFFLINE)
{
SetState(IClient::STATE_OFFLINE);
Disconnect();
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "offline error='%s'", m_aNetClient[CONN_MAIN].ErrorString());