mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 01:55:10 -07:00
[Client] Fix spurious server room join error
The server replies RespContextError when a join command is received for a room that connection is already registered in. The client was sending such duplicate joins in benign situations - double-clicking to join a room, or clicking a room the selector was already auto-joining - and answered them with a modal telling users to restart the client. Joins for the same room are now deduplicated while one is in flight, and a remaining RespContextError is healed by leaving and rejoining the room so the tab appears without a client restart. Error dialogs are only shown for user-initiated joins, so failed auto-joins no longer spam critical popups.
This commit is contained in:
parent
0f0e46a177
commit
ffc938c977
2 changed files with 64 additions and 28 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "tab.h"
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QMap>
|
||||
#include <QTextBrowser>
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
|
@ -58,10 +59,14 @@ private slots:
|
|||
int roomId);
|
||||
|
||||
private:
|
||||
void leaveAndRejoinRoom(int roomId, bool setCurrent);
|
||||
|
||||
AbstractClient *client;
|
||||
RoomSelector *roomSelector;
|
||||
QTextBrowser *serverInfoBox;
|
||||
bool shouldEmitUpdate = false;
|
||||
/** Room ids with a join command in flight, mapped to whether the tab should be focused once it opens. */
|
||||
QMap<int, bool> pendingRoomJoins;
|
||||
|
||||
public:
|
||||
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue