diff --git a/src/client/Client.hxx b/src/client/Client.hxx index b03e85629..19ceb75c7 100644 --- a/src/client/Client.hxx +++ b/src/client/Client.hxx @@ -25,7 +25,7 @@ #include "command/CommandListBuilder.hxx" #include "tag/Mask.hxx" #include "event/FullyBufferedSocket.hxx" -#include "event/TimeoutMonitor.hxx" +#include "event/TimerEvent.hxx" #include "Compiler.h" #include @@ -49,8 +49,10 @@ class Database; class Storage; class Client final - : FullyBufferedSocket, TimeoutMonitor, + : FullyBufferedSocket, public boost::intrusive::list_base_hook> { + TimerEvent timeout_event; + Partition *partition; public: @@ -228,8 +230,8 @@ private: void OnSocketError(std::exception_ptr ep) override; void OnSocketClosed() override; - /* virtual methods from class TimeoutMonitor */ - void OnTimeout() override; + /* callback for TimerEvent */ + void OnTimeout(); }; void diff --git a/src/client/ClientExpire.cxx b/src/client/ClientExpire.cxx index b8ad604dd..4a02c64f4 100644 --- a/src/client/ClientExpire.cxx +++ b/src/client/ClientExpire.cxx @@ -28,7 +28,7 @@ Client::SetExpired() return; FullyBufferedSocket::Close(); - TimeoutMonitor::Schedule(std::chrono::steady_clock::duration::zero()); + timeout_event.Schedule(std::chrono::steady_clock::duration::zero()); } void diff --git a/src/client/ClientIdle.cxx b/src/client/ClientIdle.cxx index 2791bb9a4..b9f3abacb 100644 --- a/src/client/ClientIdle.cxx +++ b/src/client/ClientIdle.cxx @@ -42,7 +42,7 @@ Client::IdleNotify() Write("OK\n"); - TimeoutMonitor::Schedule(client_timeout); + timeout_event.Schedule(client_timeout); } void @@ -69,7 +69,7 @@ Client::IdleWait(unsigned flags) return true; } else { /* disable timeouts while in "idle" */ - TimeoutMonitor::Cancel(); + timeout_event.Cancel(); return false; } } diff --git a/src/client/ClientNew.cxx b/src/client/ClientNew.cxx index 016d5f7cb..ce097e1df 100644 --- a/src/client/ClientNew.cxx +++ b/src/client/ClientNew.cxx @@ -45,13 +45,13 @@ Client::Client(EventLoop &_loop, Partition &_partition, UniqueSocketDescriptor &&_fd, int _uid, int _num) :FullyBufferedSocket(_fd.Release(), _loop, 16384, client_max_output_buffer_size), - TimeoutMonitor(_loop), + timeout_event(_loop, BIND_THIS_METHOD(OnTimeout)), partition(&_partition), permission(getDefaultPermissions()), uid(_uid), num(_num) { - TimeoutMonitor::Schedule(client_timeout); + timeout_event.Schedule(client_timeout); } void diff --git a/src/client/ClientRead.cxx b/src/client/ClientRead.cxx index a598cf812..1e806d089 100644 --- a/src/client/ClientRead.cxx +++ b/src/client/ClientRead.cxx @@ -34,7 +34,7 @@ Client::OnSocketInput(void *data, size_t length) if (newline == nullptr) return InputResult::MORE; - TimeoutMonitor::Schedule(client_timeout); + timeout_event.Schedule(client_timeout); BufferedSocket::ConsumeInput(newline + 1 - p);