fixed crash when connecting to outdated servers
This commit is contained in:
parent
1c0c7bf280
commit
cf3cab107a
3 changed files with 7 additions and 4 deletions
|
@ -295,7 +295,7 @@ What would you like to wish for?"
|
|||
|
||||
[option]
|
||||
id=WISHINGWELL4
|
||||
message=Peace threwout Wesnoth
|
||||
message=Peace throughout Wesnoth
|
||||
[command]
|
||||
[gold]
|
||||
amount=-1
|
||||
|
@ -303,7 +303,7 @@ What would you like to wish for?"
|
|||
[message]
|
||||
id=WISHINGWELL4b
|
||||
speaker=unit
|
||||
message=The only thing worth wishing for is pease threwout the land.
|
||||
message=The only thing worth wishing for is peace throughout the land.
|
||||
[/message]
|
||||
[/command]
|
||||
[/option]
|
||||
|
|
|
@ -509,7 +509,6 @@ int play_game(int argc, char** argv)
|
|||
return 0;
|
||||
} catch(network::error& e) {
|
||||
std::cerr << "caught network error...\n";
|
||||
e.disconnect();
|
||||
gui::show_dialog(disp,NULL,"",e.message,gui::OK_ONLY);
|
||||
} catch(gamemap::incorrect_format_exception& e) {
|
||||
gui::show_dialog(disp,NULL,"",std::string("The game map could not be loaded: ") + e.msg_,gui::OK_ONLY);
|
||||
|
|
|
@ -153,7 +153,8 @@ connection accept_connection()
|
|||
|
||||
void disconnect(connection s)
|
||||
{
|
||||
if(!s && nconnections() > 1) {
|
||||
if(s == 0) {
|
||||
std::cerr << "closing all sockets " << sockets.size() << "\n";
|
||||
while(sockets.empty() == false) {
|
||||
disconnect(sockets.back());
|
||||
}
|
||||
|
@ -161,6 +162,8 @@ void disconnect(connection s)
|
|||
return;
|
||||
}
|
||||
|
||||
std::cerr << "closing socket " << (int)s << "\n";
|
||||
|
||||
bad_sockets.erase(s);
|
||||
received_data.erase(s);
|
||||
current_connection = received_data.end();
|
||||
|
@ -223,6 +226,7 @@ connection receive_data(config& cfg, connection connection_num, int timeout)
|
|||
std::cerr << "received packet length: " << len << "\n";
|
||||
|
||||
if(len > 10000000) {
|
||||
std::cerr << "bad length in network packet. Throwing error\n";
|
||||
throw error(std::string("network error: bad length data"),*i);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue