Most functions works
This commit is contained in:
@@ -50,15 +50,15 @@ class Program
|
|||||||
|
|
||||||
builder.Services.AddSingleton<ICancellationRepository, CancellationRepository>();
|
builder.Services.AddSingleton<ICancellationRepository, CancellationRepository>();
|
||||||
|
|
||||||
var mroaMachine = builder.Build();
|
var host = builder.Build();
|
||||||
|
host.Services.GetService<HubRequestExtractor>();
|
||||||
//
|
//
|
||||||
// builder.Build();
|
// builder.Build();
|
||||||
// new RemoteTypeBinder();
|
// new RemoteTypeBinder();
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
_ = mroaMachine.Services.GetService<IUntrustedGateway>()!.Start();
|
_ = host.Services.GetService<IUntrustedGateway>()!.Start();
|
||||||
var gateway = mroaMachine.Services.GetService<IGatewayModule>();
|
var gateway = host.Services.GetService<IGatewayModule>();
|
||||||
gateway.Run();
|
gateway.Run();
|
||||||
|
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ class Program
|
|||||||
|
|
||||||
var frontendBridge = app.Services.GetService<IFrontendBridge>()!;
|
var frontendBridge = app.Services.GetService<IFrontendBridge>()!;
|
||||||
await frontendBridge.Connect();
|
await frontendBridge.Connect();
|
||||||
_ = app.Services.GetService<RequestExtractor>()!.StartExtraction();
|
_ = app.Services.GetService<IRequestExtractor>()!.StartExtraction();
|
||||||
_ = app.Services.GetService<UdpUntrustedInteraction>().Start(serverEndPoint);
|
_ = app.Services.GetService<IUntrustedInteractionModule>().Start(serverEndPoint);
|
||||||
Console.WriteLine(app.Services.GetService<IEndPointContext>().HostId);
|
Console.WriteLine(app.Services.GetService<IEndPointContext>().HostId);
|
||||||
var context = app.Services.GetService<RemoteInstanceRepository>();
|
var context = app.Services.GetService<IInstanceRepository>();
|
||||||
|
|
||||||
#if !JUST_LOAD
|
#if !JUST_LOAD
|
||||||
var factory =
|
var factory =
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace mROA.Implementation.Backend
|
|||||||
public class ConnectionHub : IConnectionHub
|
public class ConnectionHub : IConnectionHub
|
||||||
{
|
{
|
||||||
private readonly Dictionary<int, IChannelInteractionModule> _connections = new();
|
private readonly Dictionary<int, IChannelInteractionModule> _connections = new();
|
||||||
private IContextualSerializationToolKit _serializationToolkit;
|
private readonly IContextualSerializationToolKit _serializationToolkit;
|
||||||
|
|
||||||
public ConnectionHub(IContextualSerializationToolKit serializationToolkit)
|
public ConnectionHub(IContextualSerializationToolKit serializationToolkit)
|
||||||
{
|
{
|
||||||
@@ -16,9 +16,6 @@ namespace mROA.Implementation.Backend
|
|||||||
|
|
||||||
public void RegisterInteraction(IChannelInteractionModule interaction)
|
public void RegisterInteraction(IChannelInteractionModule interaction)
|
||||||
{
|
{
|
||||||
if (_serializationToolkit is null)
|
|
||||||
throw new NullReferenceException("Serialization toolkit is null");
|
|
||||||
|
|
||||||
_connections.Add(interaction.ConnectionId, interaction);
|
_connections.Add(interaction.ConnectionId, interaction);
|
||||||
var module = new RepresentationModule(interaction, _serializationToolkit);
|
var module = new RepresentationModule(interaction, _serializationToolkit);
|
||||||
OnConnected?.Invoke(module);
|
OnConnected?.Invoke(module);
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ namespace mROA.Implementation.Backend
|
|||||||
{
|
{
|
||||||
public class HubRequestExtractor
|
public class HubRequestExtractor
|
||||||
{
|
{
|
||||||
private IConnectionHub _hub;
|
|
||||||
|
|
||||||
private IRealStoreInstanceRepository _contextRepository;
|
private IRealStoreInstanceRepository _contextRepository;
|
||||||
private IInstanceRepository _remoteContextRepository;
|
private IInstanceRepository _remoteContextRepository;
|
||||||
private IMethodRepository _methodRepository;
|
private IMethodRepository _methodRepository;
|
||||||
@@ -14,12 +12,10 @@ namespace mROA.Implementation.Backend
|
|||||||
private IExecuteModule _executeModule;
|
private IExecuteModule _executeModule;
|
||||||
|
|
||||||
public HubRequestExtractor(IConnectionHub hub, IRealStoreInstanceRepository contextRepository,
|
public HubRequestExtractor(IConnectionHub hub, IRealStoreInstanceRepository contextRepository,
|
||||||
RemoteInstanceRepository remoteContextRepository, IMethodRepository methodRepository,
|
IInstanceRepository remoteContextRepository, IMethodRepository methodRepository,
|
||||||
IContextualSerializationToolKit serializationToolkit, IExecuteModule executeModule)
|
IContextualSerializationToolKit serializationToolkit, IExecuteModule executeModule)
|
||||||
{
|
{
|
||||||
_hub = hub;
|
hub.OnConnected += HubOnOnConnected;
|
||||||
_hub.OnConnected += HubOnOnConnected;
|
|
||||||
|
|
||||||
_contextRepository = contextRepository;
|
_contextRepository = contextRepository;
|
||||||
_remoteContextRepository = remoteContextRepository;
|
_remoteContextRepository = remoteContextRepository;
|
||||||
_methodRepository = methodRepository;
|
_methodRepository = methodRepository;
|
||||||
|
|||||||
@@ -13,17 +13,19 @@ namespace mROA.Implementation.Backend
|
|||||||
{
|
{
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly TcpListener _tcpListener;
|
private readonly TcpListener _tcpListener;
|
||||||
private IConnectionHub? _hub;
|
private readonly IConnectionHub _hub;
|
||||||
private readonly IContextualSerializationToolKit _serialization;
|
private readonly IContextualSerializationToolKit _serialization;
|
||||||
private readonly Dictionary<int, CancellationTokenSource> _extractorsCTS = new();
|
private readonly Dictionary<int, CancellationTokenSource> _extractorsCTS = new();
|
||||||
private ICallIndexProvider? _callIndexProvider;
|
private ICallIndexProvider _callIndexProvider;
|
||||||
private readonly IIdentityGenerator _identityGenerator;
|
private readonly IIdentityGenerator _identityGenerator;
|
||||||
public NetworkGatewayModule(IOptions<GatewayOptions> options, IServiceProvider service, IIdentityGenerator identityGenerator, IContextualSerializationToolKit serialization)
|
public NetworkGatewayModule(IOptions<GatewayOptions> options, IServiceProvider service, IIdentityGenerator identityGenerator, IContextualSerializationToolKit serialization, ICallIndexProvider callIndexProvider, IConnectionHub hub)
|
||||||
{
|
{
|
||||||
_tcpListener = new(options.Value.Endpoint);
|
_tcpListener = new(options.Value.Endpoint);
|
||||||
_serviceProvider = service;
|
_serviceProvider = service;
|
||||||
_identityGenerator = identityGenerator;
|
_identityGenerator = identityGenerator;
|
||||||
_serialization = serialization;
|
_serialization = serialization;
|
||||||
|
_callIndexProvider = callIndexProvider;
|
||||||
|
_hub = hub;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace mROA.Implementation
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public EndPointContext(IInstanceRepository realRepository, IInstanceRepository remoteRepository)
|
public EndPointContext(IRealStoreInstanceRepository realRepository, IInstanceRepository remoteRepository)
|
||||||
{
|
{
|
||||||
RealRepository = realRepository;
|
RealRepository = realRepository;
|
||||||
RemoteRepository = remoteRepository;
|
RemoteRepository = remoteRepository;
|
||||||
|
|||||||
@@ -14,17 +14,18 @@ namespace mROA.Implementation.Frontend
|
|||||||
{
|
{
|
||||||
private readonly IPEndPoint _serverEndPoint;
|
private readonly IPEndPoint _serverEndPoint;
|
||||||
private TcpClient _tcpClient = new();
|
private TcpClient _tcpClient = new();
|
||||||
private IChannelInteractionModule? _interactionModule;
|
private IChannelInteractionModule _interactionModule;
|
||||||
private IContextualSerializationToolKit _serialization;
|
private IContextualSerializationToolKit _serialization;
|
||||||
private ChannelInteractionModule.StreamExtractor? _currentExtractor;
|
private ChannelInteractionModule.StreamExtractor? _currentExtractor;
|
||||||
private CancellationTokenSource _rawExtractorCancellation;
|
private CancellationTokenSource _rawExtractorCancellation;
|
||||||
private IEndPointContext _context;
|
private IEndPointContext _context;
|
||||||
|
|
||||||
public NetworkFrontendBridge(IOptions<GatewayOptions> options, IEndPointContext context, IContextualSerializationToolKit serialization)
|
public NetworkFrontendBridge(IOptions<GatewayOptions> options, IEndPointContext context, IContextualSerializationToolKit serialization, IChannelInteractionModule interactionModule)
|
||||||
{
|
{
|
||||||
_serverEndPoint = options.Value.Endpoint;
|
_serverEndPoint = options.Value.Endpoint;
|
||||||
_context = context;
|
_context = context;
|
||||||
_serialization = serialization;
|
_serialization = serialization;
|
||||||
|
_interactionModule = interactionModule;
|
||||||
_rawExtractorCancellation = new CancellationTokenSource();
|
_rawExtractorCancellation = new CancellationTokenSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,12 @@ namespace mROA.Implementation
|
|||||||
|
|
||||||
private IRepresentationModuleProducer _representationProducer;
|
private IRepresentationModuleProducer _representationProducer;
|
||||||
|
|
||||||
public RemoteInstanceRepository(ICallIndexProvider callIndexProvider, IRepresentationModuleProducer representationProducer, int hostId)
|
public RemoteInstanceRepository(ICallIndexProvider callIndexProvider, IRepresentationModuleProducer representationProducer)
|
||||||
{
|
{
|
||||||
_callIndexProvider = callIndexProvider;
|
_callIndexProvider = callIndexProvider;
|
||||||
_representationProducer = representationProducer;
|
_representationProducer = representationProducer;
|
||||||
HostId = hostId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int HostId { get; set; }
|
|
||||||
|
|
||||||
public int ResisterObject<T>(object o, IEndPointContext context)
|
public int ResisterObject<T>(object o, IEndPointContext context)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user