Files
ClubPenguinServer/MareSynchronosServer/MareSynchronosServices/Authentication/FailedAuthorization.cs
rootdarkarchon c98e2b2dd6 Switch Authentication to asynchronous streaming calls (#16)
* add base grpc service and swap auth service to streaming

* remove Authorize from hub itself

* remove unused usings

* heave files server to net 7, add exception handling in grpc auth stream

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
2022-10-13 16:55:23 +02:00

28 lines
617 B
C#

using System;
using System.Threading;
using System.Threading.Tasks;
namespace MareSynchronosServices.Authentication;
internal class FailedAuthorization : IDisposable
{
private int failedAttempts = 1;
public int FailedAttempts => failedAttempts;
public Task ResetTask { get; set; }
public CancellationTokenSource? ResetCts { get; set; }
public void Dispose()
{
try
{
ResetCts?.Cancel();
ResetCts?.Dispose();
}
catch { }
}
public void IncreaseFailedAttempts()
{
Interlocked.Increment(ref failedAttempts);
}
}