mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-14 16:06:56 +00:00
35 lines
717 B
C++
35 lines
717 B
C++
#include <mesosphere/processes/KPort.hpp>
|
|
#include <mesosphere/core/KCoreContext.hpp>
|
|
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
|
|
|
namespace mesosphere
|
|
{
|
|
|
|
KPort::~KPort()
|
|
{
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
}
|