diff --git a/Example.Backend/Example.Backend.csproj b/Example.Backend/Example.Backend.csproj index b951e33..d29fff5 100644 --- a/Example.Backend/Example.Backend.csproj +++ b/Example.Backend/Example.Backend.csproj @@ -11,11 +11,11 @@ - + TRACE - + TRACE; diff --git a/Example.Backend/Program.cs b/Example.Backend/Program.cs index 7c5bcc9..f31f557 100644 --- a/Example.Backend/Program.cs +++ b/Example.Backend/Program.cs @@ -34,7 +34,7 @@ class Program })); builder.SetupMethodsRepository(new CoCodegenMethodRepository()); builder.Modules.Add(new CreativeRepresentationModuleProducer( - new IInjectableModule[] { builder.GetModule()! }, + new IInjectableModule[] { builder.GetModule()! }, typeof(RepresentationModule))); builder.Modules.Add(new CancellationRepository()); diff --git a/Example.Frontend/Example.Frontend.csproj b/Example.Frontend/Example.Frontend.csproj index 207a2b2..a12fa05 100644 --- a/Example.Frontend/Example.Frontend.csproj +++ b/Example.Frontend/Example.Frontend.csproj @@ -14,7 +14,7 @@ - + TRACE; diff --git a/mROA/Implementation/CallRequest.cs b/mROA/Implementation/CallRequest.cs index db38e5e..a6235f1 100644 --- a/mROA/Implementation/CallRequest.cs +++ b/mROA/Implementation/CallRequest.cs @@ -1,5 +1,4 @@ using System; -using System.Text.Json.Serialization; using mROA.Implementation.Attributes; // ReSharper disable UnusedAutoPropertyAccessor.Global @@ -21,9 +20,6 @@ namespace mROA.Implementation public int CommandId { get; set; } public int ObjectId { get; set; } = -1; - [SerializationIgnore] - public Type? ParameterType { get; set; } - public object? Parameter { get; set; } public override string ToString() { diff --git a/mROA/Implementation/NextGenerationInteractionModule.cs b/mROA/Implementation/NextGenerationInteractionModule.cs index e9416e9..68239ea 100644 --- a/mROA/Implementation/NextGenerationInteractionModule.cs +++ b/mROA/Implementation/NextGenerationInteractionModule.cs @@ -82,6 +82,7 @@ namespace mROA.Implementation var len = BitConverter.ToUInt16(new[] { firstBit, secondBit}); var localSpan = _buffer.Slice(0, len); + await BaseStream.ReadExactlyAsync(localSpan); // Console.WriteLine("Receiving {0}", Encoding.Default.GetString(_buffer[..len])); @@ -89,6 +90,8 @@ namespace mROA.Implementation var message = _serialization.Deserialize(localSpan.Span); #if TRACE Console.WriteLine($"Received Message {message.SchemaId} - {message.Id}"); + TransmissionConfig.TotalTransmittedBytes += len; + Console.WriteLine($"Total recieced bytes are {TransmissionConfig.TotalTransmittedBytes}"); #endif _messageBuffer.Add(message); _currentReceiving = Task.Run(async () => await GetNextMessage()); diff --git a/mROA/Implementation/RemoteObjectBase.cs b/mROA/Implementation/RemoteObjectBase.cs index a81c255..e1381dd 100644 --- a/mROA/Implementation/RemoteObjectBase.cs +++ b/mROA/Implementation/RemoteObjectBase.cs @@ -26,7 +26,8 @@ namespace mROA.Implementation CancellationToken cancellationToken = default) { var request = new DefaultCallRequest - { CommandId = methodId, ObjectId = _id, Parameter = parameter, ParameterType = parameter?.GetType() }; + { CommandId = methodId, ObjectId = _id, Parameter = parameter + }; await _representationModule.PostCallMessageAsync(request.Id, MessageType.CallRequest, request); @@ -79,7 +80,8 @@ namespace mROA.Implementation CancellationToken cancellationToken = default) { var request = new DefaultCallRequest - { CommandId = methodId, ObjectId = _id, Parameter = parameter, ParameterType = parameter?.GetType() }; + { CommandId = methodId, ObjectId = _id, Parameter = parameter + }; await _representationModule.PostCallMessageAsync(request.Id, MessageType.CallRequest, request); var localTokenSource = new CancellationTokenSource(); diff --git a/mROA/Implementation/SharedObject.cs b/mROA/Implementation/SharedObject.cs index 2eb3b47..b9d5256 100644 --- a/mROA/Implementation/SharedObject.cs +++ b/mROA/Implementation/SharedObject.cs @@ -11,6 +11,9 @@ namespace mROA.Implementation { public static class TransmissionConfig { +#if TRACE + public static int TotalTransmittedBytes { get; set; } = 0; +#endif private static IContextRepository? _realContextRepository; private static IContextRepository? _remoteEndpointContextRepository; private static IOwnershipRepository? _ownershipRepository; @@ -43,6 +46,7 @@ namespace mROA.Implementation public class SharedObject : ISharedObject where T : notnull { [SerializationIgnore] + [JsonIgnore] public IEndPointContext EndPointContext { get; set; } = new EndPointContext { RealRepository = TransmissionConfig.RealContextRepository, @@ -50,6 +54,7 @@ namespace mROA.Implementation HostId = TransmissionConfig.OwnershipRepository.GetHostOwnershipId(), OwnerFunc = TransmissionConfig.OwnershipRepository.GetOwnershipId }; + private IContextRepository GetDefaultContextRepository() => (OwnerId == EndPointContext.HostId ? EndPointContext.RealRepository @@ -89,8 +94,7 @@ namespace mROA.Implementation } } - [SerializationIgnore] - public T Value { get; private set; } + [JsonIgnore] [SerializationIgnore] public T Value { get; private set; } // ReSharper disable once MemberCanBePrivate.Global // ReSharper disable once UnusedMember.Global @@ -116,6 +120,5 @@ namespace mROA.Implementation public static implicit operator SharedObject(T value) => new(value); - } } \ No newline at end of file diff --git a/mROA/mROA.csproj b/mROA/mROA.csproj index cb237bf..5702597 100644 --- a/mROA/mROA.csproj +++ b/mROA/mROA.csproj @@ -21,7 +21,7 @@ - + TRACE;