Return of ping pong and ToString for NetworkMessageHeader
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>9</LangVersion>
|
<LangVersion>9</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ namespace mROA.Cbor
|
|||||||
return writer.Encode();
|
return writer.Encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext context)
|
public int Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext context)
|
||||||
{
|
{
|
||||||
var writer = new CborWriter();
|
var writer = new CborWriter();
|
||||||
WriteData(objectToSerialize, writer, context);
|
WriteData(objectToSerialize, writer, context);
|
||||||
writer.Encode(destination);
|
return writer.Encode(destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Deserialize<T>(byte[] rawData, IEndPointContext? context)
|
public T Deserialize<T>(byte[] rawData, IEndPointContext? context)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>2.0.2</Version>
|
<Version>2.0.3</Version>
|
||||||
<LangVersion>9</LangVersion>
|
<LangVersion>9</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace mROA.Abstract
|
|||||||
public interface IContextualSerializationToolKit : IInjectableModule
|
public interface IContextualSerializationToolKit : IInjectableModule
|
||||||
{
|
{
|
||||||
byte[] Serialize(object objectToSerialize, IEndPointContext? context);
|
byte[] Serialize(object objectToSerialize, IEndPointContext? context);
|
||||||
void Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext? context);
|
int Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext? context);
|
||||||
T Deserialize<T>(byte[] rawData, IEndPointContext? context);
|
T Deserialize<T>(byte[] rawData, IEndPointContext? context);
|
||||||
object? Deserialize(byte[] rawData, Type type, IEndPointContext? context);
|
object? Deserialize(byte[] rawData, Type type, IEndPointContext? context);
|
||||||
T Deserialize<T>(ReadOnlyMemory<byte> rawMemory, IEndPointContext? context);
|
T Deserialize<T>(ReadOnlyMemory<byte> rawMemory, IEndPointContext? context);
|
||||||
|
|||||||
@@ -121,6 +121,11 @@ namespace mROA.Implementation
|
|||||||
{
|
{
|
||||||
await PostMessageAsync(
|
await PostMessageAsync(
|
||||||
new NetworkMessageHeader(_serialization!, new ClientRecovery(Math.Abs(ConnectionId)), _context));
|
new NetworkMessageHeader(_serialization!, new ClientRecovery(Math.Abs(ConnectionId)), _context));
|
||||||
|
await ReceiveChanel.Reader.ReadAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _trustedWriter.WriteAsync(new NetworkMessageHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,5 +39,10 @@ namespace mROA.Implementation
|
|||||||
public EMessageType MessageType { get; set; }
|
public EMessageType MessageType { get; set; }
|
||||||
|
|
||||||
public byte[] Data { get; set; }
|
public byte[] Data { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $" {Id}:{MessageType} [{Data.Length}]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Title>mROA</Title>
|
<Title>mROA</Title>
|
||||||
<Version>2.0.3</Version>
|
<Version>2.0.5</Version>
|
||||||
<Authors>YaslePoy</Authors>
|
<Authors>YaslePoy</Authors>
|
||||||
<Description>Fast and easy RPC with contex</Description>
|
<Description>Fast and easy RPC with contex</Description>
|
||||||
<RepositoryUrl>https://github.com/YaslePoy/mROA</RepositoryUrl>
|
<RepositoryUrl>https://github.com/YaslePoy/mROA</RepositoryUrl>
|
||||||
|
|||||||
Reference in New Issue
Block a user