aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/ServerSocket.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-30 13:20:27 +0100
committerMax Kellermann <max@duempel.org>2013-01-30 14:16:04 +0100
commitfa51db449fdb9558a4cb4542a86437ac9dd3ddbd (patch)
tree7ecc27850e582fc6b4233bd316dcb079d0702341 /src/event/ServerSocket.cxx
parentcb9a05ac77034fdcefc0d574e768afe0a1b86327 (diff)
downloadmpd-fa51db449fdb9558a4cb4542a86437ac9dd3ddbd.tar.gz
mpd-fa51db449fdb9558a4cb4542a86437ac9dd3ddbd.tar.xz
mpd-fa51db449fdb9558a4cb4542a86437ac9dd3ddbd.zip
ServerSocket: replace callback with virtual method
Diffstat (limited to 'src/event/ServerSocket.cxx')
-rw-r--r--src/event/ServerSocket.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx
index ea2f07e38..d444933a0 100644
--- a/src/event/ServerSocket.cxx
+++ b/src/event/ServerSocket.cxx
@@ -54,7 +54,7 @@
#define DEFAULT_PORT 6600
class OneServerSocket final : private SocketMonitor {
- const ServerSocket &parent;
+ ServerSocket &parent;
const unsigned serial;
@@ -64,7 +64,7 @@ class OneServerSocket final : private SocketMonitor {
struct sockaddr *address;
public:
- OneServerSocket(EventLoop &_loop, const ServerSocket &_parent,
+ OneServerSocket(EventLoop &_loop, ServerSocket &_parent,
unsigned _serial,
const struct sockaddr *_address,
size_t _address_length)
@@ -176,10 +176,9 @@ OneServerSocket::Accept()
(const char *)msg);
}
- parent.callback(peer_fd,
- (const struct sockaddr*)&peer_address,
- peer_address_length, get_remote_uid(peer_fd),
- parent.callback_ctx);
+ parent.OnAccept(peer_fd,
+ (const sockaddr &)peer_address,
+ peer_address_length, get_remote_uid(peer_fd));
}
bool
@@ -213,12 +212,8 @@ OneServerSocket::Open(GError **error_r)
return true;
}
-ServerSocket::ServerSocket(EventLoop &_loop,
- server_socket_callback_t _callback,
- void *_callback_ctx)
- :loop(_loop),
- callback(_callback), callback_ctx(_callback_ctx),
- next_serial(1) {}
+ServerSocket::ServerSocket(EventLoop &_loop)
+ :loop(_loop), next_serial(1) {}
/* this is just here to allow the OneServerSocket forward
declaration */