2018-11-12 13:52:57 +00:00
|
|
|
#include <mesosphere/processes/KPort.hpp>
|
|
|
|
#include <mesosphere/core/KCoreContext.hpp>
|
2018-11-12 14:48:03 +00:00
|
|
|
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
2018-11-12 13:52:57 +00:00
|
|
|
|
|
|
|
namespace mesosphere
|
|
|
|
{
|
|
|
|
|
|
|
|
KPort::~KPort()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-11-12 14:48:03 +00:00
|
|
|
Result KPort::Initialize(int maxSessions, bool isLight)
|
2018-11-12 13:52:57 +00:00
|
|
|
{
|
|
|
|
SetClientServerParent();
|
|
|
|
isClientAlive = true;
|
|
|
|
isServerAlive = true;
|
|
|
|
|
2018-11-12 14:48:03 +00:00
|
|
|
client.maxSessions = maxSessions;
|
|
|
|
this->isLight = isLight;
|
|
|
|
|
2018-11-12 13:52:57 +00:00
|
|
|
return ResultSuccess();
|
|
|
|
}
|
|
|
|
|
2018-11-12 14:48:03 +00:00
|
|
|
Result KPort::AddServerSession(KLightServerSession &lightServerSession)
|
|
|
|
{
|
|
|
|
KScopedCriticalSection critsec{};
|
|
|
|
if (isClientAlive || isServerAlive) {
|
|
|
|
return ResultKernelConnectionRefused();
|
|
|
|
} else {
|
|
|
|
return server.AddServerSession(lightServerSession);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-12 13:52:57 +00:00
|
|
|
}
|