diff --git a/src/Components/Modules/Session.cpp b/src/Components/Modules/Session.cpp index ab15a2f7..5bdf4e6e 100644 --- a/src/Components/Modules/Session.cpp +++ b/src/Components/Modules/Session.cpp @@ -17,6 +17,9 @@ namespace Components void Session::Send(Network::Address target, std::string command, std::string data) { +#ifdef DISABLE_SESSION + Network::SendCommand(target, command, data); +#else std::lock_guard _(Session::Mutex); auto queue = Session::PacketQueue.find(target); @@ -33,12 +36,17 @@ namespace Components packet->tries = 0; queue->second.push(packet); +#endif } void Session::Handle(std::string packet, Utils::Slot callback) { +#ifdef DISABLE_SESSION + Network::Handle(packet, callback); +#else std::lock_guard _(Session::Mutex); Session::PacketHandlers[packet] = callback; +#endif } void Session::RunFrame() @@ -104,6 +112,7 @@ namespace Components Session::Session() { +#ifndef DISABLE_SESSION Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512); //Scheduler::OnFrame(Session::RunFrame); @@ -161,6 +170,7 @@ namespace Components handler->second(address, dataPacket.data()); }); +#endif } Session::~Session() diff --git a/src/Components/Modules/Session.hpp b/src/Components/Modules/Session.hpp index cb80ebd3..c649fd8f 100644 --- a/src/Components/Modules/Session.hpp +++ b/src/Components/Modules/Session.hpp @@ -4,6 +4,8 @@ #define SESSION_MAX_RETRIES 3 #define SESSION_REQUEST_LIMIT 3 +#define DISABLE_SESSION + namespace Components { class Session : public Component