mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
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:
parent
22c6e7ebeb
commit
aa95f61f11
|
@ -2524,7 +2524,6 @@ void CClient::PumpNetwork()
|
||||||
// check for errors
|
// check for errors
|
||||||
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITTING && m_aNetClient[CONN_MAIN].State() == NETSTATE_OFFLINE)
|
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITTING && m_aNetClient[CONN_MAIN].State() == NETSTATE_OFFLINE)
|
||||||
{
|
{
|
||||||
SetState(IClient::STATE_OFFLINE);
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
char aBuf[256];
|
char aBuf[256];
|
||||||
str_format(aBuf, sizeof(aBuf), "offline error='%s'", m_aNetClient[CONN_MAIN].ErrorString());
|
str_format(aBuf, sizeof(aBuf), "offline error='%s'", m_aNetClient[CONN_MAIN].ErrorString());
|
||||||
|
|
Loading…
Reference in a new issue