mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2025-12-13 21:34:43 +01:00
Init enter game
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#if NEED_SOCKET_SHIM
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks.Sources;
|
||||
|
||||
namespace KcpSharp
|
||||
{
|
||||
internal class AwaitableSocketAsyncEventArgs : SocketAsyncEventArgs, IValueTaskSource
|
||||
{
|
||||
private ManualResetValueTaskSourceCore<bool> _mrvtsc =
|
||||
new ManualResetValueTaskSourceCore<bool> { RunContinuationsAsynchronously = true };
|
||||
|
||||
void IValueTaskSource.GetResult(short token) => _mrvtsc.GetResult(token);
|
||||
ValueTaskSourceStatus IValueTaskSource.GetStatus(short token) => _mrvtsc.GetStatus(token);
|
||||
void IValueTaskSource.OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
|
||||
=> _mrvtsc.OnCompleted(continuation, state, token, flags);
|
||||
|
||||
protected override void OnCompleted(SocketAsyncEventArgs e)
|
||||
{
|
||||
_mrvtsc.SetResult(true);
|
||||
}
|
||||
|
||||
public ValueTask WaitAsync()
|
||||
{
|
||||
return new ValueTask(this, _mrvtsc.Version);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_mrvtsc.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user