diff --git a/mesosphere/include/mesosphere/core/KAutoObject.hpp b/mesosphere/include/mesosphere/core/KAutoObject.hpp index a038a33c8..1b8d62d5b 100644 --- a/mesosphere/include/mesosphere/core/KAutoObject.hpp +++ b/mesosphere/include/mesosphere/core/KAutoObject.hpp @@ -32,9 +32,9 @@ MESOSPHERE_AUTO_OBJECT_FW_DECL(Event); MESOSPHERE_AUTO_OBJECT_FW_DECL(ReadableEvent); MESOSPHERE_AUTO_OBJECT_FW_DECL(WritableEvent); MESOSPHERE_AUTO_OBJECT_FW_DECL(InterruptEvent); -MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseSession); -MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseClientSession); -MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseServerSession); +MESOSPHERE_AUTO_OBJECT_FW_DECL(LightSession); +MESOSPHERE_AUTO_OBJECT_FW_DECL(LightClientSession); +MESOSPHERE_AUTO_OBJECT_FW_DECL(LightServerSession); class KAutoObject { public: diff --git a/mesosphere/include/mesosphere/kresources/KResourceLimit.hpp b/mesosphere/include/mesosphere/kresources/KResourceLimit.hpp index feee2f361..3f731b3e9 100644 --- a/mesosphere/include/mesosphere/kresources/KResourceLimit.hpp +++ b/mesosphere/include/mesosphere/kresources/KResourceLimit.hpp @@ -31,6 +31,7 @@ class KResourceLimit final : case KAutoObject::TypeId::Event: return Category::Events; case KAutoObject::TypeId::TransferMemory: return Category::TransferMemories; case KAutoObject::TypeId::Session: return Category::Sessions; + case KAutoObject::TypeId::LightSession: return Category::Sessions; default: return Category::Max; } } diff --git a/mesosphere/include/mesosphere/processes/KBaseClientSession.hpp b/mesosphere/include/mesosphere/processes/KBaseClientSession.hpp deleted file mode 100644 index 3f711e115..000000000 --- a/mesosphere/include/mesosphere/processes/KBaseClientSession.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mesosphere -{ - -class KBaseServerSession; -class KBaseSession; -class KClientPort; -class KBaseClientSession : public KAutoObject, public IClient { - // Note: hidden from the KAutoObject hierarchy - - public: - - virtual ~KBaseClientSession(); - - // For covariant types - virtual KBaseSession *GetParentSession() const { return parent.get(); } - - protected: - - friend class KBaseSession; - friend class KBaseServerSession; - - KBaseClientSession() = default; - - bool isRemoteActive = false; - KClientPort *parentPort = nullptr; -}; - -MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseClientSession); - -} diff --git a/mesosphere/include/mesosphere/processes/KBaseServerSession.hpp b/mesosphere/include/mesosphere/processes/KBaseServerSession.hpp deleted file mode 100644 index 2e499bd97..000000000 --- a/mesosphere/include/mesosphere/processes/KBaseServerSession.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include - -namespace mesosphere -{ - -class KBaseClientSession; -class KBaseSession; -class KClientPort; - -struct ServerSessionListTag; -using ServerSessionListBaseHook = boost::intrusive::list_base_hook >; - -class KBaseServerSession : - public KSynchronizationObject, - public IServer, - public ServerSessionListBaseHook { - // Note: hidden from the KAutoObject hierarchy - - public: - - using List = typename boost::intrusive::make_list< - KBaseServerSession, - boost::intrusive::base_hook, - boost::intrusive::constant_time_size - >::type; - - virtual ~KBaseServerSession(); - - // For covariant types - virtual KBaseSession *GetParentSession() const { return parent.get(); } - - virtual bool IsSignaled() const override { return false; } // hacky; to make it non-abstract - - protected: - - friend class KBaseSession; - - KBaseServerSession() = default; -}; - -MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseServerSession); - -} diff --git a/mesosphere/include/mesosphere/processes/KBaseSession.hpp b/mesosphere/include/mesosphere/processes/KBaseSession.hpp deleted file mode 100644 index 215810738..000000000 --- a/mesosphere/include/mesosphere/processes/KBaseSession.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace mesosphere -{ - -class KBaseSession : public KAutoObject, public IClientServerParent { - // Note: hidden from the KAutoObject hierarchy - - public: - - virtual ~KBaseSession(); - - // For covariant types: - virtual KBaseClientSession *GetClientSession() { return &client; } - virtual KBaseServerSession *GetServerSession() { return &server; } - - protected: - - Result Initialize(); - KBaseSession() = default; -}; - -MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseSession); - -} diff --git a/mesosphere/include/mesosphere/processes/KLightClientSession.hpp b/mesosphere/include/mesosphere/processes/KLightClientSession.hpp new file mode 100644 index 000000000..c43157a49 --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KLightClientSession.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include + +namespace mesosphere +{ + +class KLightSession; +class KClientPort; + +class KLightClientSession final : public KAutoObject, public IClient { + public: + MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, LightClientSession); + + virtual ~KLightClientSession(); + + private: + friend class KLightSession; + + KClientPort *parentPort = nullptr; + bool isRemoteActive = false; +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(LightClientSession); + +} diff --git a/mesosphere/include/mesosphere/processes/KLightServerSession.hpp b/mesosphere/include/mesosphere/processes/KLightServerSession.hpp new file mode 100644 index 000000000..0a1c4487a --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KLightServerSession.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include + +namespace mesosphere +{ + +class KLightClientSession; +class KLightSession; +class KClientPort; + +struct LightServerSessionListTag; +using LightServerSessionListBaseHook = boost::intrusive::list_base_hook >; + +class KLightServerSession final : + public KSynchronizationObject, + public IServer, + public LightServerSessionListBaseHook { + + public: + + MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, LightServerSession); + + using List = typename boost::intrusive::make_list< + KLightServerSession, + boost::intrusive::base_hook, + boost::intrusive::constant_time_size + >::type; + + virtual ~KLightServerSession(); + + virtual bool IsSignaled() const override; + + private: + + friend class KLightSession; + + KThread::WaitList senderThreads{}, receiverThreads{}; + SharedPtr currentSender{}, currentReceiver{}; + bool isRemoteActive = false; +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(LightServerSession); + +} diff --git a/mesosphere/include/mesosphere/processes/KLightSession.hpp b/mesosphere/include/mesosphere/processes/KLightSession.hpp new file mode 100644 index 000000000..b3a4fdb2c --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KLightSession.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace mesosphere +{ + +class KLightSession final : + public KAutoObject, + public ISetAllocated, + public ILimitedResource, + public IClientServerParent { + + public: + MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, LightSession); + MESOSPHERE_LIMITED_RESOURCE_TRAITS(10s); + + virtual ~KLightSession(); + + Result Initialize(); +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(LightSession); + +} diff --git a/mesosphere/source/processes/KBaseClientSession.cpp b/mesosphere/source/processes/KBaseClientSession.cpp deleted file mode 100644 index de8224ecc..000000000 --- a/mesosphere/source/processes/KBaseClientSession.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -namespace mesosphere -{ - -KBaseClientSession::~KBaseClientSession() -{ -} - -} diff --git a/mesosphere/source/processes/KBaseServerSession.cpp b/mesosphere/source/processes/KBaseServerSession.cpp deleted file mode 100644 index 9a9f18c21..000000000 --- a/mesosphere/source/processes/KBaseServerSession.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -namespace mesosphere -{ - -KBaseServerSession::~KBaseServerSession() -{ - // Children classes will lock critical section + set client "isRemoteAlive" -} - -} diff --git a/mesosphere/source/processes/KBaseSession.cpp b/mesosphere/source/processes/KBaseSession.cpp deleted file mode 100644 index c58e12e78..000000000 --- a/mesosphere/source/processes/KBaseSession.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -namespace mesosphere -{ - -KBaseSession::~KBaseSession() -{ -} - -Result KBaseSession::Initialize() -{ - SetClientServerParent(); - - return ResultSuccess(); -} - -} diff --git a/mesosphere/source/processes/KLightClientSession.cpp b/mesosphere/source/processes/KLightClientSession.cpp new file mode 100644 index 000000000..491f22fbc --- /dev/null +++ b/mesosphere/source/processes/KLightClientSession.cpp @@ -0,0 +1,12 @@ +#include + +namespace mesosphere +{ + +KLightClientSession::~KLightClientSession() +{ + //TODO +} + + +} diff --git a/mesosphere/source/processes/KLightServerSession.cpp b/mesosphere/source/processes/KLightServerSession.cpp new file mode 100644 index 000000000..c0229a2ec --- /dev/null +++ b/mesosphere/source/processes/KLightServerSession.cpp @@ -0,0 +1,17 @@ +#include + +namespace mesosphere +{ + +KLightServerSession::~KLightServerSession() +{ + //TODO +} + +bool KLightServerSession::IsSignaled() const +{ + return false; // TODO +} + + +} diff --git a/mesosphere/source/processes/KLightSession.cpp b/mesosphere/source/processes/KLightSession.cpp new file mode 100644 index 000000000..8af8bf055 --- /dev/null +++ b/mesosphere/source/processes/KLightSession.cpp @@ -0,0 +1,21 @@ +#include +#include + +namespace mesosphere +{ + +KLightSession::~KLightSession() +{ +} + +Result KLightSession::Initialize() +{ + SetClientServerParent(); + client.isRemoteActive = true; + server.isRemoteActive = true; + + SetResourceOwner(KCoreContext::GetCurrentInstance().GetCurrentProcess()); + return ResultSuccess(); +} + +}