прокидывание айдишников

This commit is contained in:
2025-02-13 10:52:06 +03:00
parent 6b794e1cd9
commit cd184b9060
15 changed files with 102 additions and 57 deletions
@@ -4,6 +4,7 @@ namespace mROA.Implementation.Backend;
public class StreamBasedInteractionModule : IInteractionModule
{
private ISerialisationModule _serialisationModule;
private readonly Dictionary<int, Stream> _streams = new();
private Action<int, byte[]>? _handler;
@@ -12,6 +13,7 @@ public class StreamBasedInteractionModule : IInteractionModule
var id = Random.Shared.Next();
_streams.Add(id, stream);
_ = ListenTo((id, stream), _handler!);
_serialisationModule.SendWelcomeMessage(id);
}
public void SendTo(int clientId, byte[] message)
@@ -51,6 +53,7 @@ public class StreamBasedInteractionModule : IInteractionModule
if (dependency is ISerialisationModule serialisationModule)
{
_handler = serialisationModule.HandleIncomingRequest;
_serialisationModule = serialisationModule;
}
}