]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Don't ignore server disconnects in client code
authorsfan5 <sfan5@live.de>
Fri, 6 May 2022 18:13:45 +0000 (20:13 +0200)
committersfan5 <sfan5@live.de>
Sat, 21 May 2022 15:49:55 +0000 (17:49 +0200)
If the server stops talking to us without saying bye we
should actually end the in-game session with an error message.

src/client/client.cpp

index cb556c1ce5cf56b5fd3250b66a8f319bed4cafd7..8ab96b7d10bfccba91013cedc61d97f0e66a602c 100644 (file)
@@ -786,16 +786,18 @@ void Client::peerAdded(con::Peer *peer)
        infostream << "Client::peerAdded(): peer->id="
                        << peer->id << std::endl;
 }
+
 void Client::deletingPeer(con::Peer *peer, bool timeout)
 {
        infostream << "Client::deletingPeer(): "
                        "Server Peer is getting deleted "
                        << "(timeout=" << timeout << ")" << std::endl;
 
-       if (timeout) {
-               m_access_denied = true;
+       m_access_denied = true;
+       if (timeout)
                m_access_denied_reason = gettext("Connection timed out.");
-       }
+       else
+               m_access_denied_reason = gettext("Connection aborted (protocol error?).");
 }
 
 /*