← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1704449-net-assert into lp:widelands

 

Notabilis has proposed merging lp:~widelands-dev/widelands/bug-1704449-net-assert into lp:widelands.

Commit message:
Removing invalid assert in code for metaserver communication.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1704449 in widelands: "Assertion waitcmd_ == IGPCMD_GAME_OPEN on WIN10"
  https://bugs.launchpad.net/widelands/+bug/1704449

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1704449-net-assert/+merge/327930

Removing an assert which does not always hold. When I am not wrong, the assert can't hold in some situations. This is no bug in the code but just a case of unexpected timing, which makes the assert fail.

See linked bug report for a longer explanation.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1704449-net-assert into lp:widelands.
=== modified file 'src/network/internet_gaming.cc'
--- src/network/internet_gaming.cc	2017-07-01 08:22:54 +0000
+++ src/network/internet_gaming.cc	2017-07-22 17:33:46 +0000
@@ -598,8 +598,10 @@
 
 		else if (cmd == IGPCMD_GAME_OPEN) {
 			// Client received the acknowledgment, that the game was opened
-			assert(waitcmd_ == IGPCMD_GAME_OPEN);
-			waitcmd_ = "";
+			// We can't use an assert here since this message might arrive after the game already started
+			if (waitcmd_ == IGPCMD_GAME_OPEN) {
+				waitcmd_ = "";
+			}
 		}
 
 		else if (cmd == IGPCMD_GAME_CONNECT) {


Follow ups