Add C# dedicated server replacement
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Net;
|
||||
|
||||
namespace CommonwealthOnline.Server;
|
||||
|
||||
internal enum SendOutcome { Sent, Dropped, Backpressure, NotConnected, TooLarge, Error }
|
||||
|
||||
internal interface IGameConnection : IAsyncDisposable
|
||||
{
|
||||
string ConnectionKey { get; }
|
||||
string TransportName { get; }
|
||||
IPEndPoint RemoteEndpoint { get; }
|
||||
bool IsClosed { get; }
|
||||
ValueTask<SendOutcome> SendAsync(EncodedPacket packet, CancellationToken cancellationToken = default);
|
||||
ValueTask DisconnectAsync(int reason, string debug);
|
||||
}
|
||||
|
||||
internal interface IServerIngress
|
||||
{
|
||||
Task<bool> AcceptConnectionAsync(IGameConnection connection, CancellationToken cancellationToken);
|
||||
Task HandleMessageAsync(IGameConnection connection, ReadOnlyMemory<byte> payload, CancellationToken cancellationToken);
|
||||
Task HandleConnectionClosedAsync(IGameConnection connection);
|
||||
Task HandleTransportRejectAsync(IGameConnection connection, string reason, bool warning = false);
|
||||
Task EndSessionForTransportAsync(IGameConnection connection, string code, string reason);
|
||||
void Log(string message, string level = "info");
|
||||
}
|
||||
Reference in New Issue
Block a user