1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2025-01-10 11:26:15 +00:00
Atmosphere/mesosphere/source/processes/KPort.cpp

36 lines
727 B
C++
Raw Normal View History

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-13 00:14:55 +00:00
Result KPort::AddLightServerSession(KLightServerSession &lightServerSession)
2018-11-12 14:48:03 +00:00
{
KScopedCriticalSection critsec{};
if (isClientAlive || isServerAlive) {
return ResultKernelConnectionRefused();
} else {
2018-11-13 00:14:55 +00:00
return server.AddLightServerSession(lightServerSession);
2018-11-12 14:48:03 +00:00
}
}
2018-11-12 13:52:57 +00:00
}