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.
This commit is contained in:
10
xW/xW.cpp
10
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<uint8_t *>(&len);
|
||||
|
||||
Reference in New Issue
Block a user