From 4e30e747390ac6bb6a6e5ededfbcdae937579393 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Feb 2015 20:30:10 +0100 Subject: net/SocketAddress: light wrapper for struct sockaddr --- src/output/plugins/httpd/HttpdInternal.hxx | 3 +-- src/output/plugins/httpd/HttpdOutputPlugin.cxx | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/output') diff --git a/src/output/plugins/httpd/HttpdInternal.hxx b/src/output/plugins/httpd/HttpdInternal.hxx index d3ea49cd4..c9f983e17 100644 --- a/src/output/plugins/httpd/HttpdInternal.hxx +++ b/src/output/plugins/httpd/HttpdInternal.hxx @@ -259,8 +259,7 @@ public: private: virtual void RunDeferred() override; - virtual void OnAccept(int fd, const sockaddr &address, - size_t address_length, int uid) override; + void OnAccept(int fd, SocketAddress address, int uid) override; }; extern const class Domain httpd_output_domain; diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index 05e3d53d0..89dbcb85f 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -26,6 +26,7 @@ #include "encoder/EncoderPlugin.hxx" #include "encoder/EncoderList.hxx" #include "net/Resolver.hxx" +#include "net/SocketAddress.hxx" #include "Page.hxx" #include "IcyMetaDataServer.hxx" #include "system/fd_util.h" @@ -201,16 +202,14 @@ HttpdOutput::RunDeferred() } void -HttpdOutput::OnAccept(int fd, const sockaddr &address, - size_t address_length, gcc_unused int uid) +HttpdOutput::OnAccept(int fd, SocketAddress address, gcc_unused int uid) { /* the listener socket has become readable - a client has connected */ #ifdef HAVE_LIBWRAP - if (address.sa_family != AF_UNIX) { - const auto hostaddr = sockaddr_to_string(&address, - address_length); + if (address.GetFamily() != AF_UNIX) { + const auto hostaddr = sockaddr_to_string(address); // TODO: shall we obtain the program name from argv[0]? const char *progname = "mpd"; @@ -230,7 +229,6 @@ HttpdOutput::OnAccept(int fd, const sockaddr &address, } #else (void)address; - (void)address_length; #endif /* HAVE_WRAP */ const ScopeLock protect(mutex); -- cgit v1.2.3