net/SocketAddress: light wrapper for struct sockaddr
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
struct sockaddr;
|
||||
class SocketAddress;
|
||||
class EventLoop;
|
||||
class Path;
|
||||
struct Partition;
|
||||
@@ -204,7 +204,7 @@ void client_manager_init(void);
|
||||
|
||||
void
|
||||
client_new(EventLoop &loop, Partition &partition,
|
||||
int fd, const sockaddr *sa, size_t sa_length, int uid);
|
||||
int fd, SocketAddress address, int uid);
|
||||
|
||||
/**
|
||||
* Write a C string to the client.
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "Partition.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "system/fd_util.h"
|
||||
#include "net/SocketAddress.hxx"
|
||||
#include "net/Resolver.hxx"
|
||||
#include "Permission.hxx"
|
||||
#include "util/Error.hxx"
|
||||
@@ -58,15 +59,15 @@ Client::Client(EventLoop &_loop, Partition &_partition,
|
||||
|
||||
void
|
||||
client_new(EventLoop &loop, Partition &partition,
|
||||
int fd, const struct sockaddr *sa, size_t sa_length, int uid)
|
||||
int fd, SocketAddress address, int uid)
|
||||
{
|
||||
static unsigned int next_client_num;
|
||||
const auto remote = sockaddr_to_string(sa, sa_length);
|
||||
const auto remote = sockaddr_to_string(address);
|
||||
|
||||
assert(fd >= 0);
|
||||
|
||||
#ifdef HAVE_LIBWRAP
|
||||
if (sa->sa_family != AF_UNIX) {
|
||||
if (address.GetFamily() != AF_UNIX) {
|
||||
// TODO: shall we obtain the program name from argv[0]?
|
||||
const char *progname = "mpd";
|
||||
|
||||
|
Reference in New Issue
Block a user