Commit 86c7ab29 authored by Max Kellermann's avatar Max Kellermann

client/Idle: pass Response instead of Client to WriteIdleResponse()

parent db89e5ec
...@@ -19,21 +19,21 @@ ...@@ -19,21 +19,21 @@
#include "config.h" #include "config.h"
#include "ClientInternal.hxx" #include "ClientInternal.hxx"
#include "Response.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include <assert.h> #include <assert.h>
static void static void
WriteIdleResponse(Client &client, unsigned flags) noexcept WriteIdleResponse(Response &r, unsigned flags) noexcept
{ {
const char *const*idle_names = idle_get_names(); const char *const*idle_names = idle_get_names();
for (unsigned i = 0; idle_names[i]; ++i) { for (unsigned i = 0; idle_names[i]; ++i) {
if (flags & (1 << i)) if (flags & (1 << i))
client_printf(client, "changed: %s\n", r.Format("changed: %s\n", idle_names[i]);
idle_names[i]);
} }
client.Write("OK\n"); r.Write("OK\n");
} }
void void
...@@ -45,7 +45,8 @@ Client::IdleNotify() noexcept ...@@ -45,7 +45,8 @@ Client::IdleNotify() noexcept
unsigned flags = std::exchange(idle_flags, 0) & idle_subscriptions; unsigned flags = std::exchange(idle_flags, 0) & idle_subscriptions;
idle_waiting = false; idle_waiting = false;
WriteIdleResponse(*this, flags); Response r(*this, 0);
WriteIdleResponse(r, flags);
timeout_event.Schedule(client_timeout); 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