From 4ccb405cd18c9ae5b8fc2b896d646b7404950935 Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 19 Jul 2018 14:48:50 +0800 Subject: [PATCH] Add exception handling in handlePendingConnection --- src/network/protocols/server_lobby.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index d30e80985..e31711317 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -1857,16 +1857,25 @@ void ServerLobby::handlePendingConnection() auto key = m_keys.find(online_id); if (key != m_keys.end() && key->second.m_tried == false) { - if (decryptConnectionRequest(peer, it->second.second, - key->second.m_aes_key, key->second.m_aes_iv, online_id, - key->second.m_name)) + try { - it = m_pending_connection.erase(it); - m_keys.erase(online_id); - continue; + if (decryptConnectionRequest(peer, it->second.second, + key->second.m_aes_key, key->second.m_aes_iv, online_id, + key->second.m_name)) + { + it = m_pending_connection.erase(it); + m_keys.erase(online_id); + continue; + } + else + key->second.m_tried = true; } - else + catch (std::exception& e) + { + Log::error("ServerLobby", + "handlePendingConnection error: %s", e.what()); key->second.m_tried = true; + } } it++; }