diff --git a/Benchmarks/DataCacheBenchmark.cs b/Benchmarks/DataCacheBenchmark.cs index 3048117..da81a55 100644 --- a/Benchmarks/DataCacheBenchmark.cs +++ b/Benchmarks/DataCacheBenchmark.cs @@ -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] diff --git a/Continuity.AuthServer/Consumers/PacketConsumer.cs b/Continuity.AuthServer/Consumers/PacketConsumer.cs index c1f1b03..d227262 100644 --- a/Continuity.AuthServer/Consumers/PacketConsumer.cs +++ b/Continuity.AuthServer/Consumers/PacketConsumer.cs @@ -10,7 +10,7 @@ using Wonderking.Packets; namespace Continuity.AuthServer.Consumers; [UsedImplicitly] -public class PacketConsumer : IConsumer +public class PacketConsumer : IConsumer, IDisposable { private readonly PacketDistributorService _distributorService; @@ -32,4 +32,10 @@ public class PacketConsumer : IConsumer return _distributorService.AddPacketAsync(context.Message.MessageBody, context.Message.OperationCode, context.Message.Session); } + + public void Dispose() + { + _activitySource.Dispose(); + GC.SuppressFinalize(this); + } } diff --git a/Continuity.AuthServer/PacketHandlers/LoginHandler.cs b/Continuity.AuthServer/PacketHandlers/LoginHandler.cs index f0bef15..7d91682 100644 --- a/Continuity.AuthServer/PacketHandlers/LoginHandler.cs +++ b/Continuity.AuthServer/PacketHandlers/LoginHandler.cs @@ -80,7 +80,7 @@ public class LoginHandler : IPacketHandler private static async Task 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 private async Task CreateAccountOnLoginAsync(string username, string password) { - using var activity = _activitySource.StartActivity("CreateAccountOnLoginAsync"); + using var activity = _activitySource.StartActivity(); LoginResponseReason loginResponseReason; var transaction = await _wonderkingContext.Database.BeginTransactionAsync(); diff --git a/Wonderking/Game/Reader/BinaryReader.cs b/Wonderking/Game/Reader/BinaryReader.cs index e37562c..3bcf4ce 100644 --- a/Wonderking/Game/Reader/BinaryReader.cs +++ b/Wonderking/Game/Reader/BinaryReader.cs @@ -8,7 +8,9 @@ public static class BinaryReader where T : new() { public static readonly Func Read; +#pragma warning disable MA0051 static BinaryReader() +#pragma warning restore MA0051 { var type = typeof(T);