mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Merge #6540
6540: Fix inconsistent client state after disconnecting with network error r=def- a=Robyt3 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. ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
8375fd83a0
|
@ -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