Some changes for server in same process
This commit is contained in:
parent
acdf77baf9
commit
45825918d9
@ -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 <iostream>
|
||||
#include <iterator>
|
||||
|
||||
// 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<ServerLobby> 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<RegisterServerRequest>(now,
|
||||
@ -2294,7 +2298,8 @@ bool ServerLobby::registerServer(bool now)
|
||||
*/
|
||||
void ServerLobby::unregisterServer(bool now)
|
||||
{
|
||||
auto request = std::make_shared<Online::XMLRequest>();
|
||||
int priority = Online::RequestManager::HTTP_MAX_PRIORITY;
|
||||
auto request = std::make_shared<Online::XMLRequest>(priority);
|
||||
m_server_unregistered = request;
|
||||
NetworkConfig::get()->setServerDetails(request, "stop");
|
||||
|
||||
@ -2594,6 +2599,7 @@ void ServerLobby::checkIncomingConnectionRequests()
|
||||
{
|
||||
private:
|
||||
std::weak_ptr<ServerLobby> m_server_lobby;
|
||||
std::weak_ptr<ProtocolManager> m_protocol_manager;
|
||||
protected:
|
||||
virtual void afterOperation()
|
||||
{
|
||||
@ -2650,15 +2656,19 @@ void ServerLobby::checkIncomingConnectionRequests()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::make_shared<ConnectToPeer>(peer_addr)->requestStart();
|
||||
auto ctp = std::make_shared<ConnectToPeer>(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<ServerLobby> sl)
|
||||
: XMLRequest(), m_server_lobby(sl)
|
||||
PollServerRequest(std::shared_ptr<ServerLobby> sl,
|
||||
std::shared_ptr<ProtocolManager> 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<PollServerRequest>(
|
||||
std::dynamic_pointer_cast<ServerLobby>(shared_from_this()));
|
||||
std::dynamic_pointer_cast<ServerLobby>(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<STKPeer> peer,
|
||||
//-----------------------------------------------------------------------------
|
||||
void ServerLobby::getRankingForPlayer(std::shared_ptr<NetworkPlayerProfile> p)
|
||||
{
|
||||
auto request = std::make_shared<Online::XMLRequest>();
|
||||
int priority = Online::RequestManager::HTTP_MAX_PRIORITY;
|
||||
auto request = std::make_shared<Online::XMLRequest>(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<Online::XMLRequest>();
|
||||
int priority = Online::RequestManager::HTTP_MAX_PRIORITY;
|
||||
auto request = std::make_shared<Online::XMLRequest>(priority);
|
||||
NetworkConfig::get()->setServerDetails(request, "update-config");
|
||||
const SocketAddress& addr = STKHost::get()->getPublicAddress();
|
||||
request->addParameter("address", addr.getIP());
|
||||
|
Loading…
x
Reference in New Issue
Block a user