Итоговое уменьшение передаваемой информации в 4 раза
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants />
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants />
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -34,7 +34,7 @@ class Program
|
||||
}));
|
||||
builder.SetupMethodsRepository(new CoCodegenMethodRepository());
|
||||
builder.Modules.Add(new CreativeRepresentationModuleProducer(
|
||||
new IInjectableModule[] { builder.GetModule<CborSerializationToolkit>()! },
|
||||
new IInjectableModule[] { builder.GetModule<ISerializationToolkit>()! },
|
||||
typeof(RepresentationModule)));
|
||||
builder.Modules.Add(new CancellationRepository());
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants />
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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<NetworkMessage>(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());
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<T> : 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>(T value) =>
|
||||
new(value);
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants />
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user