1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-11-22 08:42:44 +01:00
Minecraft-Phantom-Panel/Server/Phantom.Server.Services/Agents/AgentConnection.cs

29 lines
864 B
C#

using Phantom.Common.Messages;
using Phantom.Server.Rpc;
namespace Phantom.Server.Services.Agents;
sealed class AgentConnection {
private readonly RpcClientConnection connection;
internal AgentConnection(RpcClientConnection connection) {
this.connection = connection;
}
public bool IsSame(RpcClientConnection connection) {
return this.connection.IsSame(connection);
}
public void Close() {
connection.Close();
}
public Task Send<TMessage>(TMessage message) where TMessage : IMessageToAgent {
return connection.Send(message);
}
public Task<TReply?> Send<TMessage, TReply>(TMessage message, TimeSpan waitForReplyTime, CancellationToken waitForReplyCancellationToken) where TMessage : IMessageToAgent<TReply> where TReply : class {
return connection.Send<TMessage, TReply>(message, waitForReplyTime, waitForReplyCancellationToken);
}
}