event/ServerSocket: #ifdef out local socket support on Windows

This commit is contained in:
Max Kellermann 2015-03-05 08:14:23 +01:00
parent 5798faa13b
commit 5222c684d3

View File

@ -59,7 +59,9 @@ class OneServerSocket final : private SocketMonitor {
const unsigned serial; const unsigned serial;
#ifdef HAVE_UN
AllocatedPath path; AllocatedPath path;
#endif
SocketAddress address; SocketAddress address;
@ -69,7 +71,9 @@ public:
SocketAddress _address) SocketAddress _address)
:SocketMonitor(_loop), :SocketMonitor(_loop),
parent(_parent), serial(_serial), parent(_parent), serial(_serial),
#ifdef HAVE_UN
path(AllocatedPath::Null()), path(AllocatedPath::Null()),
#endif
address((sockaddr *)xmemdup(_address.GetAddress(), address((sockaddr *)xmemdup(_address.GetAddress(),
_address.GetSize()), _address.GetSize()),
_address.GetSize()) _address.GetSize())
@ -92,11 +96,13 @@ public:
return serial; return serial;
} }
#ifdef HAVE_UN
void SetPath(AllocatedPath &&_path) { void SetPath(AllocatedPath &&_path) {
assert(path.IsNull()); assert(path.IsNull());
path = std::move(_path); path = std::move(_path);
} }
#endif
bool Open(Error &error); bool Open(Error &error);
@ -193,10 +199,12 @@ OneServerSocket::Open(Error &error)
if (_fd < 0) if (_fd < 0)
return false; return false;
#ifdef HAVE_UN
/* allow everybody to connect */ /* allow everybody to connect */
if (!path.IsNull()) if (!path.IsNull())
chmod(path.c_str(), 0666); chmod(path.c_str(), 0666);
#endif
/* register in the EventLoop */ /* register in the EventLoop */