2020-02-11 17:44:06 -05:00
|
|
|
|
using System;
|
2020-04-17 16:05:16 -04:00
|
|
|
|
using System.Collections.Generic;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
2021-06-03 11:51:03 -04:00
|
|
|
|
namespace Integrations.Cod
|
2020-02-11 17:44:06 -05:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// used to keep track of the udp connection state
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class ConnectionState
|
|
|
|
|
{
|
|
|
|
|
~ConnectionState()
|
|
|
|
|
{
|
|
|
|
|
OnComplete.Dispose();
|
|
|
|
|
OnSentData.Dispose();
|
|
|
|
|
OnReceivedData.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int ConnectionAttempts { get; set; }
|
2021-01-17 21:04:32 -05:00
|
|
|
|
private const int BufferSize = 16384;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public readonly byte[] ReceiveBuffer = new byte[BufferSize];
|
2022-04-25 16:39:30 -04:00
|
|
|
|
public readonly SemaphoreSlim OnComplete = new(1, 1);
|
2022-02-02 17:21:08 -05:00
|
|
|
|
public readonly SemaphoreSlim OnSentData = new(1, 1);
|
|
|
|
|
public readonly SemaphoreSlim OnReceivedData = new (1, 1);
|
|
|
|
|
|
2022-03-05 14:13:00 -05:00
|
|
|
|
public List<int> BytesReadPerSegment { get; set; } = new();
|
|
|
|
|
public SocketAsyncEventArgs SendEventArgs { get; set; } = new();
|
|
|
|
|
public SocketAsyncEventArgs ReceiveEventArgs { get; set; } = new();
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public DateTime LastQuery { get; set; } = DateTime.Now;
|
|
|
|
|
}
|
2022-03-05 14:13:00 -05:00
|
|
|
|
|
|
|
|
|
internal class ConnectionUserToken
|
|
|
|
|
{
|
|
|
|
|
public Socket Socket { get; set; }
|
|
|
|
|
public CancellationToken CancellationToken { get; set; }
|
|
|
|
|
}
|
2022-02-02 17:21:08 -05:00
|
|
|
|
}
|