Display an access denied message when client detects a server timeout
authorKahrl <kahrl@gmx.net>
Fri, 17 Jul 2015 06:51:07 +0000 (08:51 +0200)
committerKahrl <kahrl@gmx.net>
Fri, 17 Jul 2015 10:06:30 +0000 (12:06 +0200)
src/client.cpp

index 66aac6229e3535e9dd7a5bcc99c33af32f82a3c3..1bd8c39aeeaafc97fbef21d46c8803bd709f983b 100644 (file)
@@ -743,14 +743,19 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
 // Virtual methods from con::PeerHandler
 void Client::peerAdded(con::Peer *peer)
 {
-       infostream<<"Client::peerAdded(): peer->id="
-                       <<peer->id<<std::endl;
+       infostream << "Client::peerAdded(): peer->id="
+                       << peer->id << std::endl;
 }
 void Client::deletingPeer(con::Peer *peer, bool timeout)
 {
-       infostream<<"Client::deletingPeer(): "
+       infostream << "Client::deletingPeer(): "
                        "Server Peer is getting deleted "
-                       <<"(timeout="<<timeout<<")"<<std::endl;
+                       << "(timeout=" << timeout << ")" << std::endl;
+
+       if (timeout) {
+               m_access_denied = true;
+               m_access_denied_reason = gettext("Connection timed out.");
+       }
 }
 
 /*