summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-29 23:48:16 +0100
committerMax Kellermann <max@musicpd.org>2018-01-29 23:48:16 +0100
commit1df5c5a76e5dbec19553b92130a66a8221e31dda (patch)
treed4309f1e6bea7e3b5fee8b9ab886330c63c8ffd7 /src
parent52da387a1d0a0590082f929d8217db3675e9f153 (diff)
Listen: move class ClientListener to src/client/Listener.hxx
Diffstat (limited to 'src')
-rw-r--r--src/Listen.cxx17
-rw-r--r--src/client/Listener.cxx32
-rw-r--r--src/client/Listener.hxx40
3 files changed, 73 insertions, 16 deletions
diff --git a/src/Listen.cxx b/src/Listen.cxx
index ae5d9d050..6873f7c3c 100644
--- a/src/Listen.cxx
+++ b/src/Listen.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "Listen.hxx"
-#include "client/Client.hxx"
+#include "client/Listener.hxx"
#include "config/Param.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
@@ -43,21 +43,6 @@ static constexpr Domain listen_domain("listen");
#define DEFAULT_PORT 6600
-class ClientListener final : public ServerSocket {
- Partition &partition;
-
-public:
- ClientListener(EventLoop &_loop, Partition &_partition)
- :ServerSocket(_loop), partition(_partition) {}
-
-private:
- void OnAccept(UniqueSocketDescriptor fd,
- SocketAddress address, int uid) override {
- client_new(GetEventLoop(), partition,
- std::move(fd), address, uid);
- }
-};
-
static ClientListener *listen_socket;
int listen_port;
diff --git a/src/client/Listener.cxx b/src/client/Listener.cxx
new file mode 100644
index 000000000..4747e4e59
--- /dev/null
+++ b/src/client/Listener.cxx
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003-2018 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+#include "Listener.hxx"
+#include "Client.hxx"
+#include "net/UniqueSocketDescriptor.hxx"
+#include "net/SocketAddress.hxx"
+
+void
+ClientListener::OnAccept(UniqueSocketDescriptor fd,
+ SocketAddress address, int uid) noexcept
+{
+ client_new(GetEventLoop(), partition,
+ std::move(fd), address, uid);
+}
diff --git a/src/client/Listener.hxx b/src/client/Listener.hxx
new file mode 100644
index 000000000..d889b9d1c
--- /dev/null
+++ b/src/client/Listener.hxx
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003-2018 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_CLIENT_LISTENER_HXX
+#define MPD_CLIENT_LISTENER_HXX
+
+#include "check.h"
+#include "event/ServerSocket.hxx"
+
+struct Partition;
+
+class ClientListener final : public ServerSocket {
+ Partition &partition;
+
+public:
+ ClientListener(EventLoop &_loop, Partition &_partition)
+ :ServerSocket(_loop), partition(_partition) {}
+
+private:
+ void OnAccept(UniqueSocketDescriptor fd,
+ SocketAddress address, int uid) noexcept override;
+};
+
+#endif