1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-13 16:48:27 -05:00

cleanup and simplify the CoD RCon implementation

This commit is contained in:
RaidMax
2022-10-23 14:03:57 -05:00
parent 7b2cd19fc1
commit 59acaadb92
4 changed files with 199 additions and 415 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Threading;
namespace Integrations.Cod
@ -13,26 +12,13 @@ namespace Integrations.Cod
~ConnectionState()
{
OnComplete.Dispose();
OnSentData.Dispose();
OnReceivedData.Dispose();
}
public int ConnectionAttempts { get; set; }
private const int BufferSize = 16384;
public readonly byte[] ReceiveBuffer = new byte[BufferSize];
public readonly SemaphoreSlim OnComplete = new(1, 1);
public readonly SemaphoreSlim OnSentData = new(1, 1);
public readonly SemaphoreSlim OnReceivedData = new (1, 1);
public List<int> BytesReadPerSegment { get; set; } = new();
public SocketAsyncEventArgs SendEventArgs { get; set; } = new();
public SocketAsyncEventArgs ReceiveEventArgs { get; set; } = new();
public List<byte[]> ReceivedBytes { get; } = new();
public DateTime LastQuery { get; set; } = DateTime.Now;
}
internal class ConnectionUserToken
{
public Socket Socket { get; set; }
public CancellationToken CancellationToken { get; set; }
}
}