Fixed emote duplicate issue. Improved chatter tracking. Used stores in Login Handler in cases where databases was used instead.

This commit is contained in:
Tom
2025-03-07 17:34:27 +00:00
parent fd0bca5c7c
commit 4d0743c4aa
4 changed files with 64 additions and 69 deletions

View File

@@ -6,10 +6,12 @@ namespace HermesSocketServer.Socket.Handlers
{
public class ChatterHandler : ISocketHandler
{
private const int CHATTER_BUFFER_SIZE = 2000;
public int OperationCode { get; } = 6;
private readonly Database _database;
private readonly HashSet<long> _chatters;
private readonly ChatterMessage[] _array;
private readonly long[] _array;
private readonly ILogger _logger;
private readonly object _lock;
@@ -19,8 +21,8 @@ namespace HermesSocketServer.Socket.Handlers
{
_database = database;
_logger = logger;
_chatters = new HashSet<long>(1001);
_array = new ChatterMessage[1000];
_chatters = new HashSet<long>(CHATTER_BUFFER_SIZE);
_array = new long[CHATTER_BUFFER_SIZE];
_index = -1;
_lock = new object();
}
@@ -40,7 +42,11 @@ namespace HermesSocketServer.Socket.Handlers
if (_index == _array.Length - 1)
_index = -1;
_array[++_index] = data;
var previous = _array[++_index];
if (previous != 0) {
_chatters.Remove(previous);
}
_array[_index] = data.Id;
}
try