aboutsummaryrefslogtreecommitdiff
path: root/xT
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2025-05-09 22:34:25 +0200
committerPřemysl Eric Janouch <p@janouch.name>2025-05-10 12:08:51 +0200
commit7ba17a016140f578bccca3ffd320c1663cf66c6c (patch)
treeac6404da3f3745c46c962547b2b56105802b8513 /xT
parent4cf8c394b9b07d4bab2ea297edcfeb566af8e28f (diff)
downloadxK-7ba17a016140f578bccca3ffd320c1663cf66c6c.tar.gz
xK-7ba17a016140f578bccca3ffd320c1663cf66c6c.tar.xz
xK-7ba17a016140f578bccca3ffd320c1663cf66c6c.zip
Make the relay acknowledge all received commandsorigin/master
To that effect, bump liberty and the xC relay protocol version. Relay events have been reordered to improve forward compatibility. Also prevent use-after-free when serialization fails. xP now slightly throttles activity notifications, and indicates when there are unacknowledged commands.
Diffstat (limited to 'xT')
-rw-r--r--xT/xT.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/xT/xT.cpp b/xT/xT.cpp
index f84c87c..d82b87b 100644
--- a/xT/xT.cpp
+++ b/xT/xT.cpp
@@ -180,6 +180,14 @@ beep()
// --- Networking --------------------------------------------------------------
static void
+on_relay_generic_response(
+ std::wstring error, const Relay::ResponseData *response)
+{
+ if (!response)
+ show_error_message(QString::fromStdWString(error));
+}
+
+static void
relay_send(Relay::CommandData *data, Callback callback = {})
{
Relay::CommandMessage m = {};
@@ -190,6 +198,8 @@ relay_send(Relay::CommandData *data, Callback callback = {})
if (callback)
g.command_callbacks[m.command_seq] = std::move(callback);
+ else
+ g.command_callbacks[m.command_seq] = on_relay_generic_response;
auto len = qToBigEndian<uint32_t>(w.data.size());
auto prefix = reinterpret_cast<const char *>(&len);