client/Idle: pass Response instead of Client to WriteIdleResponse()
This commit is contained in:
@@ -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
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user