diff --git a/Server/Program.cs b/Server/Program.cs index 17f38e7..62d7fbf 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -12,7 +12,6 @@ Server.Server server = new Server.Server(); HashSet shineBag = new HashSet(); CancellationTokenSource cts = new CancellationTokenSource(); bool restartRequested = false; -Task listenTask = server.Listen(cts.Token); Logger consoleLogger = new Logger("Console"); DiscordBot bot = new DiscordBot(); await bot.Run(); @@ -654,7 +653,8 @@ Task.Run(() => { }).ContinueWith(x => { if (x.Exception != null) { consoleLogger.Error(x.Exception.ToString()); } }); #pragma warning restore CS4014 -await listenTask; +await server.Listen(cts.Token); + if (restartRequested) //need to do this here because this needs to happen after the listener closes, and there isn't an //easy way to sync in the restartserver command without it exiting Main() {