network: reworked client-server events (related to triggers dialog problem from #11173) (#11189)

* added bad connection mode to test client works on slow network, use -Dxmage.badconnection;
* added bad connection protection in events processing due event type;
* split events to different types (can be ignored, must be synced, etc);
* removed some unused server events.
This commit is contained in:
Oleg Agafonov 2023-09-21 18:40:52 +04:00 committed by GitHub
parent fa8e93a29d
commit 342979a55a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 299 additions and 202 deletions

View file

@ -38,7 +38,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
private FeedbackMode mode;
private MageDialog connectedDialog;
private ChatPanelBasic connectedChatPanel;
private int lastMessageId;
private Map<String, Serializable> lastOptions = new HashMap<>();
private static final ScheduledExecutorService WORKER = Executors.newSingleThreadScheduledExecutor();
@ -66,14 +65,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
}
public void prepareFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options,
int messageId, boolean gameNeedUserFeedback, TurnPhase gameTurnPhase) {
boolean gameNeedUserFeedback, TurnPhase gameTurnPhase) {
synchronized (this) {
if (messageId < this.lastMessageId) {
// if too many warning messages here then look at GAME_REDRAW_GUI event logic
LOGGER.warn("catch un-synced message from later source (possible reason: connection or performance problems): " + messageId + ", text=" + message);
return;
}
this.lastMessageId = messageId;
this.lastOptions = options;
this.mode = mode;
}