aboutsummaryrefslogtreecommitdiffstats
path: root/src/ClientInternal.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-16 21:39:40 +0100
committerMax Kellermann <max@duempel.org>2013-01-16 21:51:08 +0100
commitb0bbb8b693d846c2710ec84bfa79dcaa3a21729a (patch)
tree43cba39160446e9379c188ebb23eae5633de4ea7 /src/ClientInternal.hxx
parentcab84af72e373acca0e88d9b407aa97796c083e0 (diff)
downloadmpd-b0bbb8b693d846c2710ec84bfa79dcaa3a21729a.tar.gz
mpd-b0bbb8b693d846c2710ec84bfa79dcaa3a21729a.tar.xz
mpd-b0bbb8b693d846c2710ec84bfa79dcaa3a21729a.zip
Client: use TimeoutMonitor to track connection timeout
Don't use a global loop over the whole client list.
Diffstat (limited to 'src/ClientInternal.hxx')
-rw-r--r--src/ClientInternal.hxx25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/ClientInternal.hxx b/src/ClientInternal.hxx
index 9384b84ee..097029f0b 100644
--- a/src/ClientInternal.hxx
+++ b/src/ClientInternal.hxx
@@ -25,6 +25,7 @@
#include "ClientMessage.hxx"
#include "CommandListBuilder.hxx"
#include "event/BufferedSocket.hxx"
+#include "event/TimeoutMonitor.hxx"
#include "command.h"
#include <set>
@@ -43,7 +44,7 @@ enum {
struct Partition;
-class Client final : private BufferedSocket {
+class Client final : private BufferedSocket, TimeoutMonitor {
public:
Partition &partition;
struct playlist &playlist;
@@ -54,11 +55,6 @@ public:
/** the uid of the client process, or -1 if unknown */
int uid;
- /**
- * How long since the last activity from this client?
- */
- GTimer *last_activity;
-
CommandListBuilder cmd_list;
unsigned int num; /* client number */
@@ -91,7 +87,6 @@ public:
Client(EventLoop &loop, Partition &partition,
int fd, int uid, int num);
- ~Client();
bool IsConnected() const {
return BufferedSocket::IsDefined();
@@ -125,6 +120,9 @@ private:
size_t length) override;
virtual void OnSocketError(GError *error) override;
virtual void OnSocketClosed() override;
+
+ /* virtual methods from class TimeoutMonitor */
+ virtual bool OnTimeout() override;
};
extern unsigned int client_max_connections;
@@ -132,19 +130,6 @@ extern int client_timeout;
extern size_t client_max_command_list_size;
extern size_t client_max_output_buffer_size;
-/**
- * Schedule an "expired" check for all clients: permanently delete
- * clients which have been set "expired" with client_set_expired().
- */
-void
-client_schedule_expire(void);
-
-/**
- * Removes a scheduled "expired" check.
- */
-void
-client_deinit_expire(void);
-
enum command_return
client_read(Client *client);