Skip to content

Commit

Permalink
Don't log twice on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Dec 18, 2024
1 parent 5c3b6fc commit afd9042
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions RLBotCS/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@
bridgeHandler.Start();

// Block until everything properly shuts down
void WaitForShutdown()
void WaitForShutdown(bool log = true)
{
rlbotServer.Join();
logger.LogInformation("RLBot server has shut down successfully.");
if (log)
logger.LogInformation("TCP handler has shut down successfully.");

bridgeWriter.TryComplete();

bridgeHandler.Join();
logger.LogInformation("Bridge handler has shut down successfully.");
if (log)
logger.LogInformation("Bridge handler has shut down successfully.");
}

void Terminate()
Expand All @@ -108,4 +110,4 @@ void Terminate()
Console.CancelKeyPress += (_, _) => Terminate();

// Wait for a normal shutdown
WaitForShutdown();
WaitForShutdown(false);

0 comments on commit afd9042

Please sign in to comment.