Notabilis has proposed merging 
lp:~widelands-dev/widelands/internet-gaming-reset into lp:widelands.

Commit message:
Resetting the local state of the internet gaming when logging into the 
metaserver.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/internet-gaming-reset/+merge/337129

Resetting the local state of the internet gaming when logging into the 
metaserver.
Currently, this is only done on logout. If the game jumps to the main menu due 
to other reasons (timeout, exception, ...) the state is not reset, resulting in 
a wrong state of the lobby after logging in again.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/internet-gaming-reset into lp:widelands.
=== modified file 'src/network/internet_gaming.cc'
--- src/network/internet_gaming.cc	2018-01-29 00:09:28 +0000
+++ src/network/internet_gaming.cc	2018-02-04 11:48:39 +0000
@@ -102,7 +102,6 @@
 	// First of all try to connect to the metaserver
 	log("InternetGaming: Connecting to the metaserver.\n");
 	NetAddress addr;
-	net.reset();
 	if (NetAddress::resolve_to_v6(&addr, meta_, port_)) {
 		net = NetClient::connect(addr);
 	}
@@ -127,6 +126,10 @@
                            const std::string& meta,
                            uint32_t port) {
 
+	// Reset local state. Only resetting on logout() or error isn't enough since
+	// the game might jump to the main menu from other places, too
+	reset();
+
 	clientname_ = nick;
 	reg_ = registered;
 	meta_ = meta;

=== modified file 'src/network/netrelayconnection.cc'
--- src/network/netrelayconnection.cc	2017-12-17 14:45:23 +0000
+++ src/network/netrelayconnection.cc	2018-02-04 11:48:39 +0000
@@ -291,7 +291,7 @@
 	assert(host.is_valid());
 	const boost::asio::ip::tcp::endpoint destination(host.ip, host.port);
 
-	log("[NetRelayConnection]: Trying to connect to %s:%u ... ", host.ip.to_string().c_str(),
+	log("[NetRelayConnection] Trying to connect to %s:%u ... ", host.ip.to_string().c_str(),
 	    host.port);
 	boost::system::error_code ec;
 	socket_.connect(destination, ec);

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to