Skip to content

Commit

Permalink
Bots: shutdown if there is an error connecting to lobby (#12747)
Browse files Browse the repository at this point in the history
If bot fails to connect, it will just hang out and not reconnect.
This update shuts the bot down in such a case (in which case
it might be auto-restarted)
  • Loading branch information
DanVanAtta authored Jul 22, 2024
1 parent 7b88a13 commit 768be30
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import games.strategy.engine.data.properties.IEditableProperty;
import games.strategy.engine.framework.GameDataManager;
import games.strategy.engine.framework.GameObjectStreamFactory;
import games.strategy.engine.framework.GameRunner;
import games.strategy.engine.framework.GameState;
import games.strategy.engine.framework.message.PlayerListing;
import games.strategy.engine.framework.startup.LobbyWatcherThread;
Expand Down Expand Up @@ -277,6 +278,10 @@ private GameHostingResponse createServerMessenger(final ServerConnectionProps pr
} catch (final IOException e) {
log.error("Unable to create server socket.", e);
cancel();
if (GameRunner.headless()) {
log.error("Failed to connect to lobby, shutting down.");
ExitStatus.FAILURE.exit();
}
}
return null;
}
Expand Down

0 comments on commit 768be30

Please sign in to comment.