diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index 44af04f45..7bc714601 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -46,6 +46,7 @@ #include "network/stk_ipv6.hpp" #include "network/stk_peer.hpp" #include "online/online_profile.hpp" +#include "online/request_manager.hpp" #include "online/xml_request.hpp" #include "race/race_manager.hpp" #include "states_screens/online/networking_lobby.hpp" @@ -64,6 +65,8 @@ #include #include +// We use max priority for all server requests to avoid downloading of addons +// icons blocking the poll request in all-in-one graphical client server #ifdef ENABLE_SQLITE3 @@ -2239,7 +2242,8 @@ bool ServerLobby::registerServer(bool now) } public: RegisterServerRequest(bool now, std::shared_ptr sl) - : XMLRequest(), m_server_lobby(sl), m_execute_now(now) {} + : XMLRequest(Online::RequestManager::HTTP_MAX_PRIORITY), + m_server_lobby(sl), m_execute_now(now) {} }; // RegisterServerRequest auto request = std::make_shared(now, @@ -2294,7 +2298,8 @@ bool ServerLobby::registerServer(bool now) */ void ServerLobby::unregisterServer(bool now) { - auto request = std::make_shared(); + int priority = Online::RequestManager::HTTP_MAX_PRIORITY; + auto request = std::make_shared(priority); m_server_unregistered = request; NetworkConfig::get()->setServerDetails(request, "stop"); @@ -2594,6 +2599,7 @@ void ServerLobby::checkIncomingConnectionRequests() { private: std::weak_ptr m_server_lobby; + std::weak_ptr m_protocol_manager; protected: virtual void afterOperation() { @@ -2650,15 +2656,19 @@ void ServerLobby::checkIncomingConnectionRequests() { continue; } - std::make_shared(peer_addr)->requestStart(); + auto ctp = std::make_shared(peer_addr); + if (auto pm = m_protocol_manager.lock()) + pm->requestStart(ctp); sl->addPeerConnection(peer_addr_str); } } sl->replaceKeys(keys); } public: - PollServerRequest(std::shared_ptr sl) - : XMLRequest(), m_server_lobby(sl) + PollServerRequest(std::shared_ptr sl, + std::shared_ptr pm) + : XMLRequest(Online::RequestManager::HTTP_MAX_PRIORITY), + m_server_lobby(sl), m_protocol_manager(pm) { m_disable_sending_log = true; } @@ -2666,7 +2676,8 @@ void ServerLobby::checkIncomingConnectionRequests() // ======================================================================== auto request = std::make_shared( - std::dynamic_pointer_cast(shared_from_this())); + std::dynamic_pointer_cast(shared_from_this()), + ProtocolManager::lock()); NetworkConfig::get()->setServerDetails(request, "poll-connection-requests"); const SocketAddress& addr = STKHost::get()->getPublicAddress(); @@ -4231,7 +4242,8 @@ bool ServerLobby::decryptConnectionRequest(std::shared_ptr peer, //----------------------------------------------------------------------------- void ServerLobby::getRankingForPlayer(std::shared_ptr p) { - auto request = std::make_shared(); + int priority = Online::RequestManager::HTTP_MAX_PRIORITY; + auto request = std::make_shared(priority); NetworkConfig::get()->setUserDetails(request, "get-ranking"); const uint32_t id = p->getOnlineId(); @@ -4298,7 +4310,7 @@ void ServerLobby::submitRankingsToAddons() SubmitRankingRequest(uint32_t online_id, double scores, double max_scores, unsigned num_races, const std::string& country_code) - : XMLRequest() + : XMLRequest(Online::RequestManager::HTTP_MAX_PRIORITY) { addParameter("id", online_id); addParameter("scores", scores); @@ -4790,7 +4802,8 @@ void ServerLobby::handleServerConfiguration(Event* event) Log::info("ServerLobby", "Updating server info with new " "difficulty: %d, game mode: %d to stk-addons.", new_difficulty, new_game_mode); - auto request = std::make_shared(); + int priority = Online::RequestManager::HTTP_MAX_PRIORITY; + auto request = std::make_shared(priority); NetworkConfig::get()->setServerDetails(request, "update-config"); const SocketAddress& addr = STKHost::get()->getPublicAddress(); request->addParameter("address", addr.getIP());