chore: code quality adjustments
This commit is contained in:
parent
ca67b62f52
commit
2e70bf0772
4 changed files with 12 additions and 4 deletions
|
@ -57,7 +57,7 @@ public class DataCacheBenchmark
|
|||
public void ConcurrentDictionaryAddOrUpdate()
|
||||
{
|
||||
ParallelEnumerable.Range(0, N).AsParallel().ForAll(i =>
|
||||
_concurrentDictionary.AddOrUpdate(N + i, i, (key, oldValue) => oldValue + i));
|
||||
_concurrentDictionary.AddOrUpdate(N + i, i, (_, oldValue) => oldValue + i));
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
|
|
|
@ -10,7 +10,7 @@ using Wonderking.Packets;
|
|||
namespace Continuity.AuthServer.Consumers;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class PacketConsumer : IConsumer<RawPacket>
|
||||
public class PacketConsumer : IConsumer<RawPacket>, IDisposable
|
||||
{
|
||||
private readonly PacketDistributorService<OperationCode, AuthSession> _distributorService;
|
||||
|
||||
|
@ -32,4 +32,10 @@ public class PacketConsumer : IConsumer<RawPacket>
|
|||
return _distributorService.AddPacketAsync(context.Message.MessageBody, context.Message.OperationCode,
|
||||
context.Message.Session);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_activitySource.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
|||
|
||||
private static async Task<byte[]> GetPasswordHashAsync(string password, byte[] salt, Guid userId)
|
||||
{
|
||||
using var activity = _activitySource.StartActivity("GetPasswordHashAsync");
|
||||
using var activity = _activitySource.StartActivity();
|
||||
// https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Chea1t_Sheet.html#argon2id
|
||||
// "Use Argon2id with a minimum configuration of 19 MiB of memory, an iteration count of 2, and 1 degree of parallelism."
|
||||
var argon2Id = new Argon2id(Encoding.ASCII.GetBytes(password))
|
||||
|
@ -96,7 +96,7 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
|||
|
||||
private async Task<LoginResponseReason> CreateAccountOnLoginAsync(string username, string password)
|
||||
{
|
||||
using var activity = _activitySource.StartActivity("CreateAccountOnLoginAsync");
|
||||
using var activity = _activitySource.StartActivity();
|
||||
LoginResponseReason loginResponseReason;
|
||||
var transaction =
|
||||
await _wonderkingContext.Database.BeginTransactionAsync();
|
||||
|
|
|
@ -8,7 +8,9 @@ public static class BinaryReader<T> where T : new()
|
|||
{
|
||||
public static readonly Func<BinaryReader, T> Read;
|
||||
|
||||
#pragma warning disable MA0051
|
||||
static BinaryReader()
|
||||
#pragma warning restore MA0051
|
||||
{
|
||||
var type = typeof(T);
|
||||
|
||||
|
|
Loading…
Reference in a new issue