don't claim connection timed out...

...when network_send/receive_dialog() was aborted (fixes bug #8795:
Connect (to MP server) -> press Cancel -> no need for "Connection
timed out" -dialog)
This commit is contained in:
Gunter Labes 2008-01-09 08:58:24 +00:00
parent f5b3f14808
commit 832dcc96b2
4 changed files with 7 additions and 6 deletions

View file

@ -1395,7 +1395,7 @@ void game_controller::upload_campaign(const std::string& campaign, network::conn
sock = dialogs::network_send_dialog(disp(),_("Sending add-on"),data,sock);
if(!sock) {
gui::show_error_message(disp(), _("Connection timed out"));
return;
} else if(data.child("error")) {
gui::show_error_message(disp(), _("The server responded with an error: \"") +
(*data.child("error"))["message"].str() + '"');

View file

@ -176,6 +176,7 @@ static server_type open_connection(game_display& disp, const std::string& origin
data.clear();
network::connection data_res = dialogs::network_receive_dialog(
disp,_("Reading from Server..."),data);
if (!data_res) return ABORT_SERVER;
mp::check_response(data_res, data);
// Backwards-compatibility "version" attribute

View file

@ -212,6 +212,10 @@ void wait::join_game(bool observe)
for(;;) {
network::connection data_res = dialogs::network_receive_dialog(disp(),
_("Getting game data..."), level_);
if (!data_res) {
set_result(QUIT);
return;
}
check_response(data_res, level_);
if(level_.child("leave_game")) {
set_result(QUIT);

View file

@ -456,11 +456,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
cfg.clear();
network::connection data_res = dialogs::network_receive_dialog(disp,
msg, cfg);
if(!data_res)
// FIXME: Why say timeout if the dialog was aborted?
//! @todo Check when this error is caught. Maybe rather
//! use 'return QUIT'?
throw network::error(_("Connection timed out"));
if(!data_res) return QUIT;
} while(cfg.child("next_scenario") == NULL);
if(cfg.child("next_scenario")) {