From d3bf4ec577319b6a64db5b1240606d74f674f03e Mon Sep 17 00:00:00 2001 From: Koncord Date: Fri, 19 May 2017 22:03:57 +0800 Subject: [PATCH] [Browser] Do not try to receive packet if sending is failed. --- apps/browser/netutils/QueryClient.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/browser/netutils/QueryClient.cpp b/apps/browser/netutils/QueryClient.cpp index 2efc739df..39db4a1cb 100644 --- a/apps/browser/netutils/QueryClient.cpp +++ b/apps/browser/netutils/QueryClient.cpp @@ -41,16 +41,17 @@ QueryClient &QueryClient::Get() map QueryClient::Query() { + status = -1; map query; if (Connect() == IS_NOT_CONNECTED) - { - status = -1; return query; - } BitStream bs; bs.Write((unsigned char) (ID_MASTER_QUERY)); - peer->Send(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, CHANNEL_MASTER, masterAddr, false); + int code = peer->Send(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, CHANNEL_MASTER, masterAddr, false); + + if (code == 0) + return query; pmq->SetServers(&query); status = GetAnswer(); @@ -106,6 +107,8 @@ MASTER_PACKETS QueryClient::GetAnswer() update = false; id = pid; break; + case ID_CONNECTION_REQUEST_ACCEPTED: + break; default: break; }