From a3dd82d6be22d5874136688f27f58dd9e67971cf Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Thu, 8 May 2025 13:04:22 +0200 Subject: WIP: Acknowledge received commands Event the smallest protocol change has great consequences. Relay events have been reordered to improve forward compatibility. WIP: - xM handling (send) - xA handling (relaySend) - xC: fix connection killing --- xW/xW.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xW/xW.cpp') diff --git a/xW/xW.cpp b/xW/xW.cpp index 7fd8950..0840c16 100644 --- a/xW/xW.cpp +++ b/xW/xW.cpp @@ -221,6 +221,14 @@ relay_try_write(std::wstring &error) return true; } +static void +on_relay_generic_response( + std::wstring error, const Relay::ResponseData *response) +{ + if (!response) + show_error_message(error.c_str()); +} + static void relay_send(Relay::CommandData *data, Callback callback = {}) { @@ -232,6 +240,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; uint32_t len = htonl(w.data.size()); uint8_t *prefix = reinterpret_cast(&len); -- cgit v1.2.3-70-g09d2