← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~ebke/widelands/ping-on-pause into lp:widelands

 

Johannes Ebke has proposed merging lp:~ebke/widelands/ping-on-pause into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1027058 in widelands: "Connection lost after some time if all players pause in multiplayer"
  https://bugs.launchpad.net/widelands/+bug/1027058

For more details, see:
https://code.launchpad.net/~ebke/widelands/ping-on-pause/+merge/116114

Also start the socket keep-alive ping if all players agree on pausing the game.
-- 
https://code.launchpad.net/~ebke/widelands/ping-on-pause/+merge/116114
Your team Widelands Developers is requested to review the proposed merge of lp:~ebke/widelands/ping-on-pause into lp:widelands.
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2012-07-13 20:46:30 +0000
+++ src/network/nethost.cc	2012-07-21 11:45:25 +0000
@@ -2472,8 +2472,9 @@
 		}
 	}
 
-	// If a pause was forced, send a ping regulary to keep the sockets up and running
-	if (m_forced_pause && (time(0) > (d->lastpauseping + 20))) {
+	// If a pause was forced or if the players all pause, send a ping regularly
+        // to keep the sockets up and running
+	if ((m_forced_pause || realSpeed() == 0) && (time(0) > (d->lastpauseping + 20))) {
 		d->lastpauseping = time(0);
 
 		SendPacket s;


Follow ups