[Session] Disable sessions for now to make the game more stable
This commit is contained in:
parent
622242f3b0
commit
87b02f1b49
@ -17,6 +17,9 @@ namespace Components
|
|||||||
|
|
||||||
void Session::Send(Network::Address target, std::string command, std::string data)
|
void Session::Send(Network::Address target, std::string command, std::string data)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_SESSION
|
||||||
|
Network::SendCommand(target, command, data);
|
||||||
|
#else
|
||||||
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
||||||
|
|
||||||
auto queue = Session::PacketQueue.find(target);
|
auto queue = Session::PacketQueue.find(target);
|
||||||
@ -33,12 +36,17 @@ namespace Components
|
|||||||
packet->tries = 0;
|
packet->tries = 0;
|
||||||
|
|
||||||
queue->second.push(packet);
|
queue->second.push(packet);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::Handle(std::string packet, Utils::Slot<Network::Callback> callback)
|
void Session::Handle(std::string packet, Utils::Slot<Network::Callback> callback)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_SESSION
|
||||||
|
Network::Handle(packet, callback);
|
||||||
|
#else
|
||||||
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
||||||
Session::PacketHandlers[packet] = callback;
|
Session::PacketHandlers[packet] = callback;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::RunFrame()
|
void Session::RunFrame()
|
||||||
@ -104,6 +112,7 @@ namespace Components
|
|||||||
|
|
||||||
Session::Session()
|
Session::Session()
|
||||||
{
|
{
|
||||||
|
#ifndef DISABLE_SESSION
|
||||||
Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512);
|
Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512);
|
||||||
//Scheduler::OnFrame(Session::RunFrame);
|
//Scheduler::OnFrame(Session::RunFrame);
|
||||||
|
|
||||||
@ -161,6 +170,7 @@ namespace Components
|
|||||||
|
|
||||||
handler->second(address, dataPacket.data());
|
handler->second(address, dataPacket.data());
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::~Session()
|
Session::~Session()
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#define SESSION_MAX_RETRIES 3
|
#define SESSION_MAX_RETRIES 3
|
||||||
#define SESSION_REQUEST_LIMIT 3
|
#define SESSION_REQUEST_LIMIT 3
|
||||||
|
|
||||||
|
#define DISABLE_SESSION
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
class Session : public Component
|
class Session : public Component
|
||||||
|
Loading…
Reference in New Issue
Block a user