Commit db89e5ec authored by Max Kellermann's avatar Max Kellermann

client/Idle: move code to WriteIdleResponse()

parent d096f75f
......@@ -23,6 +23,19 @@
#include <assert.h>
static void
WriteIdleResponse(Client &client, unsigned flags) noexcept
{
const char *const*idle_names = idle_get_names();
for (unsigned i = 0; idle_names[i]; ++i) {
if (flags & (1 << i))
client_printf(client, "changed: %s\n",
idle_names[i]);
}
client.Write("OK\n");
}
void
Client::IdleNotify() noexcept
{
......@@ -32,14 +45,7 @@ Client::IdleNotify() noexcept
unsigned flags = std::exchange(idle_flags, 0) & idle_subscriptions;
idle_waiting = false;
const char *const*idle_names = idle_get_names();
for (unsigned i = 0; idle_names[i]; ++i) {
if (flags & (1 << i))
client_printf(*this, "changed: %s\n",
idle_names[i]);
}
Write("OK\n");
WriteIdleResponse(*this, flags);
timeout_event.Schedule(client_timeout);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment