Add Id to MessageReceived

This commit is contained in:
Mike Nolan 2023-06-19 05:03:38 -05:00
parent 4fa8af7a54
commit bd4d33670e
2 changed files with 7 additions and 5 deletions

View File

@ -38,12 +38,14 @@ namespace Tesses.RPC
public sealed class MessageReceived<T,TType>
{
Action<TType> reply;
internal MessageReceived(T data,bool needReply,Action<TType> reply)
internal MessageReceived(T data,bool needReply,long id,Action<TType> reply)
{
Data = data;
NeedReply = needReply;
this.reply=reply;
Id = id;
}
public long Id {get;private set;}
public T Data {get;private set;}
public bool NeedReply {get;private set;}
public void Reply(TType msg)
@ -85,7 +87,7 @@ namespace Tesses.RPC
if(recv!=null && msg.MessageState != MessageState.ResponseNoForget)
{
MessageReceived<T,TType> msg0=new MessageReceived<T,TType>(msg.Value.ToObject<T>(),msg.MessageState != MessageState.Forget ,(reply)=>{
MessageReceived<T,TType> msg0=new MessageReceived<T,TType>(msg.Value.ToObject<T>(),msg.MessageState != MessageState.Forget ,msg.Id,(reply)=>{
SendMessageResponse(reply,msg.Id);
});
recv?.Invoke(msg0);

View File

@ -10,9 +10,9 @@
<PackageId>Tesses.RPC</PackageId>
<Author>Mike Nolan</Author>
<Company>Tesses</Company>
<Version>1.0.1</Version>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<Version>1.0.2</Version>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
<Description>A simple RPC library for .NET</Description>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>