mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-24 22:42:53 +01:00
29 lines
864 B
C#
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);
|
|
}
|
|
}
|