Supercell.GUT/Supercell.GUT.Server/GUTServer.cs

29 lines
681 B
C#
Raw Normal View History

using Microsoft.Extensions.Hosting;
using Supercell.GUT.Server.Network;
using Supercell.GUT.Titan.Debugging;
namespace Supercell.GUT.Server;
internal class GUTServer : IHostedService
{
private readonly IServerGateway _gateway;
public GUTServer(IServerGateway serverGateway, IDebuggerListener debuggerListener)
{
_gateway = serverGateway;
Debugger.SetListener(debuggerListener);
}
public Task StartAsync(CancellationToken cancellationToken)
{
_gateway.Start();
return Task.CompletedTask;
}
public async Task StopAsync(CancellationToken cancellationToken)
{
await _gateway.ShutdownAsync();
}
}