From 7ba17a016140f578bccca3ffd320c1663cf66c6c Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Fri, 9 May 2025 22:34:25 +0200 Subject: Make the relay acknowledge all received commands 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. --- xT/xT.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xT') diff --git a/xT/xT.cpp b/xT/xT.cpp index f84c87c..d82b87b 100644 --- a/xT/xT.cpp +++ b/xT/xT.cpp @@ -179,6 +179,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 = {}) { @@ -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(w.data.size()); auto prefix = reinterpret_cast(&len); -- cgit v1.2.3-70-g09d2