meso: impl AddServerSession

This commit is contained in:
TuxSH authored and Michael Scire committed 2019-06-03 17:41:08 -07:00
1 parent 173bde2eca
commit efe7325af3
5 files changed
+40 -3

No files matched your search

+16 -1
View File
@@ -1,5 +1,6 @@
#include <mesosphere/processes/KPort.hpp>
#include <mesosphere/core/KCoreContext.hpp>
#include <mesosphere/threading/KScopedCriticalSection.hpp>
namespace mesosphere
{
@@ -8,13 +9,27 @@ KPort::~KPort()
{
}
Result KPort::Initialize()
Result KPort::Initialize(int maxSessions, bool isLight)
{
SetClientServerParent();
isClientAlive = true;
isServerAlive = true;
client.maxSessions = maxSessions;
this->isLight = isLight;
return ResultSuccess();
}
Result KPort::AddServerSession(KLightServerSession &lightServerSession)
{
KScopedCriticalSection critsec{};
if (isClientAlive || isServerAlive) {
return ResultKernelConnectionRefused();
} else {
return server.AddServerSession(lightServerSession);
}
}
}
+17 -1
View File
@@ -14,7 +14,23 @@ KServerPort::~KServerPort()
bool KServerPort::IsSignaled() const
{
return false; // TODO
if (!parent->isLight) {
return false; // TODO
} else {
return !lightServerSessions.empty();
}
}
Result KServerPort::AddServerSession(KLightServerSession &lightServerSession)
{
KScopedCriticalSection critsec{};
bool wasEmpty = lightServerSessions.empty();
lightServerSessions.push_back(lightServerSession);
if (wasEmpty && !lightServerSessions.empty()) {
NotifyWaiters();
}
return ResultSuccess();
}
}