diff --git a/Example.Frontend/Program.cs b/Example.Frontend/Program.cs index 842c0dd..f5323d2 100644 --- a/Example.Frontend/Program.cs +++ b/Example.Frontend/Program.cs @@ -69,6 +69,7 @@ class Program Console.WriteLine(string.Join(", ", names)); var page = printer.Value.Print("Test Page", new CancellationToken()).GetAwaiter().GetResult(); + Console.WriteLine("Page printed"); var data = page.Value.GetData(); Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data)); diff --git a/mROA/Abstract/IRequestExtractor.cs b/mROA/Abstract/IRequestExtractor.cs index d49194b..30711fc 100644 --- a/mROA/Abstract/IRequestExtractor.cs +++ b/mROA/Abstract/IRequestExtractor.cs @@ -4,6 +4,6 @@ namespace mROA.Abstract { public interface IRequestExtractor : IInjectableModule { - Task StartExtraction(); + Task StartExtraction(); } } \ No newline at end of file diff --git a/mROA/Implementation/Backend/BasicExecutionModule.cs b/mROA/Implementation/Backend/BasicExecutionModule.cs index ec57413..3207c34 100644 --- a/mROA/Implementation/Backend/BasicExecutionModule.cs +++ b/mROA/Implementation/Backend/BasicExecutionModule.cs @@ -41,10 +41,12 @@ namespace mROA.Implementation.Backend if (currentCommand.ReturnType.BaseType == typeof(Task) && currentCommand.ReturnType.GenericTypeArguments.Length == 1) - return TypedExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo, representationModule); + return TypedExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo, + representationModule); if (currentCommand.ReturnType == typeof(Task)) - return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo, representationModule); + return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo, + representationModule); return Execute(currentCommand, context, parameter, command); } @@ -76,7 +78,8 @@ namespace mROA.Implementation.Backend } private static ICommandExecution ExecuteAsync(MethodInfo currentCommand, object context, object? parameter, - ICallRequest command, ICancellationRepository cancellationRepository, IRepresentationModule representationModule) + ICallRequest command, ICancellationRepository cancellationRepository, + IRepresentationModule representationModule) { var tokenSource = new CancellationTokenSource(); cancellationRepository.RegisterCancellation(command.Id, tokenSource); @@ -96,14 +99,17 @@ namespace mROA.Implementation.Backend Id = command.Id, CommandId = command.CommandId }; + var multiClientOwnershipRepository = + TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository; + multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id); representationModule.PostCallMessage(command.Id, MessageType.FinishedCommandExecution, payload); + multiClientOwnershipRepository?.FreeOwnership(); }, token); return new AsyncCommandExecution { Id = command.Id, CommandId = command.CommandId }; - } catch (Exception e) { @@ -116,7 +122,8 @@ namespace mROA.Implementation.Backend } private static ICommandExecution TypedExecuteAsync(MethodInfo currentCommand, object context, object? parameter, - ICallRequest command, ICancellationRepository cancellationRepository, IRepresentationModule representationModule) + ICallRequest command, ICancellationRepository cancellationRepository, + IRepresentationModule representationModule) { var tokenSource = new CancellationTokenSource(); cancellationRepository.RegisterCancellation(command.Id, tokenSource); @@ -140,7 +147,11 @@ namespace mROA.Implementation.Backend CommandId = command.CommandId, Type = finalResult?.GetType() }; + var multiClientOwnershipRepository = + TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository; + multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id); representationModule.PostCallMessage(command.Id, MessageType.FinishedCommandExecution, payload); + multiClientOwnershipRepository?.FreeOwnership(); }, token); return new AsyncCommandExecution diff --git a/mROA/Implementation/Frontend/RequestExtractor.cs b/mROA/Implementation/Frontend/RequestExtractor.cs index 6d58ce6..fe89331 100644 --- a/mROA/Implementation/Frontend/RequestExtractor.cs +++ b/mROA/Implementation/Frontend/RequestExtractor.cs @@ -99,5 +99,6 @@ namespace mROA.Implementation.Frontend multiClientOwnershipRepository?.FreeOwnership(); } } + } } \ No newline at end of file