Commit c0589beb authored by Colomban Wendling's avatar Colomban Wendling
Browse files

Bot: properly handle join errors

parent ba51ee42
......@@ -175,25 +175,28 @@ public int main (string[] args)
#if HAVE_POSIX
setup_signal_handlers ();
#endif
try {
bot.join.begin (server);
/* wait to let others join */
Timeout.add_seconds (5, () => {
if (bot.game.state != OVCC.GameState.STARTED) {
debug ("let the show begin!");
try {
bot.play ();
} catch (Error e) {
warning ("Failed to start playing: %s", e.message);
bot.join.begin (server, (o, r) => {
try {
bot.join.end (r);
/* wait to let others join */
Timeout.add_seconds (5, () => {
if (bot.game.state != OVCC.GameState.STARTED) {
debug ("let the show begin!");
try {
bot.play ();
} catch (Error e) {
warning ("Failed to start playing: %s", e.message);
}
}
}
return false;
});
loop.run ();
} catch (Error e) {
warning ("Failed to join on the server: %s", e.message);
}
return false;
});
} catch (Error e) {
warning ("Failed to join on the server: %s", e.message);
loop.quit ();
}
});
loop.run ();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment