diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2025-05-09 22:34:25 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2025-05-09 23:12:41 +0200 |
commit | d647405a20932a2ee131b4287c8b99de38b95a8d (patch) | |
tree | 88f2753edf05c37405f54201f51c30b10a78b669 /xC.lxdr | |
parent | d572cfeb40b996a898f6d67d273fac2fab37c86e (diff) | |
download | xK-d647405a20932a2ee131b4287c8b99de38b95a8d.tar.gz xK-d647405a20932a2ee131b4287c8b99de38b95a8d.tar.xz xK-d647405a20932a2ee131b4287c8b99de38b95a8d.zip |
WIP: Make the relay acknowledge received commands
xP now slightly throttles activity notifications,
and indicates when there are unacknowledged commands.
Relay events have been reordered to improve forward compatibility.
As can be observed, even the smallest protocol change has
great consequences.
WIP:
- xC: fix connection killing
Diffstat (limited to 'xC.lxdr')
-rw-r--r-- | xC.lxdr | 53 |
1 files changed, 26 insertions, 27 deletions
@@ -1,7 +1,8 @@ // Backwards-compatible protocol version. -const VERSION = 1; +const VERSION = 2; // From the frontend to the relay. +// All commands receive either an Event.RESPONSE, or an Event.ERROR. struct CommandMessage { // The command sequence number will be repeated in responses // in the respective fields. @@ -32,13 +33,10 @@ struct CommandMessage { // XXX: Perhaps this should rather be handled through a /buffer command. case BUFFER_TOGGLE_UNIMPORTANT: string buffer_name; - case PING_RESPONSE: - u32 event_seq; - - // Only these commands may produce Event.RESPONSE, as below, - // but any command may produce an error. case PING: void; + case PING_RESPONSE: + u32 event_seq; case BUFFER_COMPLETE: string buffer_name; string text; @@ -52,6 +50,9 @@ struct CommandMessage { struct EventMessage { u32 event_seq; union EventData switch (enum Event { + ERROR, + RESPONSE, + PING, BUFFER_LINE, BUFFER_UPDATE, @@ -64,12 +65,28 @@ struct EventMessage { SERVER_UPDATE, SERVER_RENAME, SERVER_REMOVE, - ERROR, - RESPONSE, } event) { + // Restriction: command_seq strictly follows the sequence received + // by the relay, across both of these replies. + case ERROR: + u32 command_seq; + string error; + case RESPONSE: + u32 command_seq; + union ResponseData switch (Command command) { + case BUFFER_COMPLETE: + u32 start; + string completions<>; + case BUFFER_LOG: + // UTF-8, but not guaranteed. + u8 log<>; + default: + // Reception acknowledged. + void; + } data; + case PING: void; - case BUFFER_LINE: string buffer_name; // Whether the line should also be displayed in the active buffer. @@ -188,23 +205,5 @@ struct EventMessage { string new; case SERVER_REMOVE: string server_name; - - // Restriction: command_seq strictly follows the sequence received - // by the relay, across both of these replies. - case ERROR: - u32 command_seq; - string error; - case RESPONSE: - u32 command_seq; - union ResponseData switch (Command command) { - case PING: - void; - case BUFFER_COMPLETE: - u32 start; - string completions<>; - case BUFFER_LOG: - // UTF-8, but not guaranteed. - u8 log<>; - } data; } data; }; |