Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3293 closed enhancement (fixed)

[PATCH] OOS error can display who is oos

Reported by: elexis Owned by: Itms
Priority: Nice to Have Milestone: Alpha 19
Component: Network Keywords: patch
Cc: Patch:

Description

(1) Out-of-sync error messages should display which players are actually out of sync. This has the advantage that players don't need to guess which player is fine and which is not. The host checks in CNetServerTurnManager::NotifyFinishedClientUpdate if all clients are in sync. The list of clients that are oos should be sent along with the CSyncErrorMessage.

(2) If the CSyncErrorMessage is received by the clients, the list of oos players should be saved in a global variable and displayed in the game & player info dialog #3263.

(3) Also the hash values in the oos error message shouldn't be displayed, since they don't contain any information at all and only distract and confuse users.

Attachments (4)

t3293_show_who_is_oos_v1_16870.patch (10.1 KB ) - added by elexis 9 years ago.
Shows who is out of sync and doesn't display the hash value in the error message anymore. Also prevents the CSyncCheckMessage and CSyncErrorMessage from being sent after oos was discovered to improve network performance.
t3293_show_who_is_oos_v1.1_16876.patch (11.1 KB ) - added by elexis 9 years ago.
Some cleaning (mostly references instead of copies) and added comma to message.
screenshot_ospath_utf8_bug.png (276.4 KB ) - added by elexis 9 years ago.
t3293_show_who_is_oos_v1.2.patch (10.9 KB ) - added by elexis 9 years ago.
Some cleanup.

Download all attachments as: .zip

Change History (12)

by elexis, 9 years ago

Shows who is out of sync and doesn't display the hash value in the error message anymore. Also prevents the CSyncCheckMessage and CSyncErrorMessage from being sent after oos was discovered to improve network performance.

by elexis, 9 years ago

Some cleaning (mostly references instead of copies) and added comma to message.

comment:1 by elexis, 9 years ago

Keywords: patch review added
Milestone: BacklogAlpha 19
Summary: OOS error can display who is oos[PATCH] OOS error can display who is oos
Type: defectenhancement

comment:2 by Itms, 9 years ago

NetClient.cpp

  • m_Playernames -> m_PlayerNames

NetTurnManager.cpp

  • why switching to a wstringstream? Just apply utf8_from_wstring to the player names
  • this code with the first boolean is ugly. Just make a standard loop starting at i = 1, and make sure all vector sizes will produce a valid output.
  • l 446: early return
  • oos_Playernames -> OOSPlayerNames
  • l 662: typo

Also, could you convert the vector of custom type elements to a regular vector of CStrW in CNetTurnManager::OnSyncError? That would prevent this swarm of ugly pointer types in the other function prototypes.

Thanks for working on this :)

in reply to:  2 comment:3 by elexis, 9 years ago

1) Replying to Itms:

NetTurnManager.cpp why switching to a wstringstream? Just apply utf8_from_wstring to the player names

a) OsString(OsPath(*path)) is wstring. If I'm not mistaken the current code in CNetTurnManager::DisplayOOSError is wrong:

 msg << L"Dumping current state to " << OsPath(*path).string(); 

Actual non-UTF8 character like 'ä' or 'ß' in that string are not translated appropriately if you don't use OsString(OsPath(*path)) but utf8_from_wstring(OsPath(*path).string()). In #3258 I got many problems with that because I renamed replay directories with those characters.

b) g_GUI->DisplayMessageBox takes a wstring and all our arguments (playernames and path) are given as wstring too. So if msg should be a stringstream we would have to convert, concatenate and then convert back while introducing translation errors.


2) Replying to Itms:

Also, could you convert the vector of custom type elements to a regular vector of CStrW in CNetTurnManager::OnSyncError? That would prevent this swarm of ugly pointer types in the other function prototypes.

The uglyness would just be moved to the conversion in CNetTurnManager::OnSyncError. We'd be introducing 4 new ugly lines - either for-loop that calls for simplification or an unusual lambda function. Just because std::vector<CSyncErrorMessage::S_m_PlayerNames> is an unusual type it doesn't mean that we have to convert it (at least if the conversion is not inline).

Not really a swarm, only 2 functions have that argument (CNetTurnManager::OnSyncError and CNetTurnManager::DisplayOOSError) and we would only remove it from the latter.


Thanks for reviewing! I agree with the other points and have updated the patch.

by elexis, 9 years ago

by elexis, 9 years ago

Some cleanup.

comment:4 by elexis, 9 years ago

1) After some more cleanup, I agree to use stringstream instead of wstringstream as with the latter we would need this L in front of every hardcoded string. (The stringstream/wstringstream seems to automatically convert from UTF8 to 16 characters and vice versa, but I'm not sure if thats a bug or a feature).

1)a) Confirmed, the current svn code is broken for non ASCII pathnames. See screenshot above. Reproduce by introducing such a character:

	OsPath path = psLogDir()/"öös_dump.txt";

OsPath is implemented in in source/lib/os_path.h and source/lib/path.h. You can trigger an OOS error by adding true to the oos check in L646 of CNetTurnManager.cpp. In the patch attached, the bug is fixed by using OsString accordingly instead of .string().

2) This would be the unusual conversion. Not sure why it segfaults, but I wouldn't want to convert anyway.

std::vector<CStr> playerNames2;
std::transform(playerNames.begin(), playerNames.end(), playerNames2.begin(),
[](const CSyncErrorMessage::S_m_PlayerNames& playerName)
	{ return utf8_from_wstring(playerName.m_Name); });

comment:5 by Itms, 9 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 16963:

Display which player(s) are OOS when it happens. Also fix some encoding issues with file paths.

Patch by elexis, fixes #3293.

comment:6 by Itms, 9 years ago

Keywords: review removed

Thanks for your work :)

comment:7 by Itms, 9 years ago

In 16965:

Revert a wrong piece of code from r16963. Refs #3293

comment:8 by elexis, 8 years ago

Component: Core engineNetwork

(set component to network)

Note: See TracTickets for help on using tickets.