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