blob: 93f0f34cd0971a5bd12e4e2f7e2077ba097239c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.Horizon.Common;
namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
class KPort : KAutoObject
{
public KServerPort ServerPort { get; }
public KClientPort ClientPort { get; }
private string _name;
private ChannelState _state;
public bool IsLight { get; private set; }
public KPort(KernelContext context, int maxSessions, bool isLight, string name) : base(context)
{
ServerPort = new KServerPort(context, this);
ClientPort = new KClientPort(context, this, maxSessions);
IsLight = isLight;
_name = name;
_state = ChannelState.Open;
}
public Result EnqueueIncomingSession(KServerSession session)
{
Result result;
KernelContext.CriticalSection.Enter();
if (_state == ChannelState.Open)
{
ServerPort.EnqueueIncomingSession(session);
result = Result.Success;
}
else
{
result = KernelResult.PortClosed;
}
KernelContext.CriticalSection.Leave();
return result;
}
public Result EnqueueIncomingLightSession(KLightServerSession session)
{
Result result;
KernelContext.CriticalSection.Enter();
if (_state == ChannelState.Open)
{
ServerPort.EnqueueIncomingLightSession(session);
result = Result.Success;
}
else
{
result = KernelResult.PortClosed;
}
KernelContext.CriticalSection.Leave();
return result;
}
}
}
|