meso: Implement KLightServerSession dtor
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
#include <mesosphere/processes/KLightClientSession.hpp>
|
||||
#include <mesosphere/processes/KLightSession.hpp>
|
||||
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
KLightClientSession::~KLightClientSession()
|
||||
{
|
||||
//TODO
|
||||
parent->Terminate(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include <mesosphere/processes/KLightServerSession.hpp>
|
||||
#include <mesosphere/processes/KLightSession.hpp>
|
||||
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
KLightServerSession::~KLightServerSession()
|
||||
{
|
||||
//TODO
|
||||
Terminate(true);
|
||||
}
|
||||
|
||||
bool KLightServerSession::IsSignaled() const
|
||||
@@ -13,5 +15,30 @@ bool KLightServerSession::IsSignaled() const
|
||||
return false; // TODO
|
||||
}
|
||||
|
||||
void KLightServerSession::Terminate(bool fromServer)
|
||||
{
|
||||
SharedPtr<KThread> curSender{std::move(currentSender)};
|
||||
{
|
||||
KScopedCriticalSection critsec{};
|
||||
if (fromServer) {
|
||||
parent->isServerAlive = false; // buggy in official kernel -- where it sets it outside of critical section
|
||||
} else {
|
||||
parent->isClientAlive = false;
|
||||
}
|
||||
if (curSender != nullptr) {
|
||||
kassert(curSender->GetSchedulingStatus() == KThread::SchedulingStatus::Paused && curSender->IsInKernelSync());
|
||||
curSender->CancelKernelSync(ResultKernelConnectionClosed()); //TODO check
|
||||
currentSender = nullptr;
|
||||
currentReceiver = nullptr;
|
||||
}
|
||||
|
||||
for (auto &&sender : senderThreads) {
|
||||
kassert(sender.GetSchedulingStatus() == KThread::SchedulingStatus::Paused && sender.IsInKernelSync());
|
||||
sender.CancelKernelSync(ResultKernelConnectionClosed()); //TODO check
|
||||
}
|
||||
|
||||
KThread::ResumeAllFromKernelSync(receiverThreads);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,16 @@ KLightSession::~KLightSession()
|
||||
Result KLightSession::Initialize()
|
||||
{
|
||||
SetClientServerParent();
|
||||
client.isRemoteActive = true;
|
||||
server.isRemoteActive = true;
|
||||
isClientAlive = true;
|
||||
isServerAlive = true;
|
||||
|
||||
SetResourceOwner(KCoreContext::GetCurrentInstance().GetCurrentProcess());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
void KLightSession::Terminate(bool fromServer)
|
||||
{
|
||||
server.Terminate(fromServer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user