event/ServerSocket, config/Net: abstract socket support
This commit is contained in:
parent
f10afd38b5
commit
44422b2b2f
1
NEWS
1
NEWS
@ -1,6 +1,7 @@
|
|||||||
ver 0.21.6 (not yet released)
|
ver 0.21.6 (not yet released)
|
||||||
* input
|
* input
|
||||||
- cdio_paranoia: fix build failure due to missing #include
|
- cdio_paranoia: fix build failure due to missing #include
|
||||||
|
* support abstract sockets on Linux
|
||||||
|
|
||||||
ver 0.21.5 (2019/02/22)
|
ver 0.21.5 (2019/02/22)
|
||||||
* protocol
|
* protocol
|
||||||
|
@ -531,6 +531,12 @@ choice::
|
|||||||
|
|
||||||
bind_to_address "/var/run/mpd/socket"
|
bind_to_address "/var/run/mpd/socket"
|
||||||
|
|
||||||
|
On Linux, local sockets can be bound to a name without a socket inode
|
||||||
|
on the filesystem; MPD implements this by prepending ``@`` to the
|
||||||
|
address::
|
||||||
|
|
||||||
|
bind_to_address "@mpd"
|
||||||
|
|
||||||
If no port is specified, the default port is 6600. This default can
|
If no port is specified, the default port is 6600. This default can
|
||||||
be changed with the port setting::
|
be changed with the port setting::
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne
|
|||||||
server_socket.AddPort(port);
|
server_socket.AddPort(port);
|
||||||
} else if (address[0] == '/' || address[0] == '~') {
|
} else if (address[0] == '/' || address[0] == '~') {
|
||||||
server_socket.AddPath(ParsePath(address));
|
server_socket.AddPath(ParsePath(address));
|
||||||
|
#ifdef __linux__
|
||||||
|
} else if (address[0] == '@') {
|
||||||
|
server_socket.AddAbstract(address);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
server_socket.AddHost(address, port);
|
server_socket.AddHost(address, port);
|
||||||
}
|
}
|
||||||
|
@ -396,3 +396,19 @@ ServerSocket::AddPath(AllocatedPath &&path)
|
|||||||
#endif /* !HAVE_UN */
|
#endif /* !HAVE_UN */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerSocket::AddAbstract(const char *name)
|
||||||
|
{
|
||||||
|
assert(name != nullptr);
|
||||||
|
assert(*name == '@');
|
||||||
|
|
||||||
|
AllocatedSocketAddress address;
|
||||||
|
address.SetLocal(name);
|
||||||
|
|
||||||
|
AddAddress(std::move(address));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -99,6 +99,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
void AddPath(AllocatedPath &&path);
|
void AddPath(AllocatedPath &&path);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
/**
|
||||||
|
* Add a listener on an abstract local socket (Linux specific).
|
||||||
|
*
|
||||||
|
* Throws on error.
|
||||||
|
*
|
||||||
|
* @param name the abstract socket name, starting with a '@'
|
||||||
|
* instead of a null byte
|
||||||
|
*/
|
||||||
|
void AddAbstract(const char *name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a socket descriptor that is accepting connections. After this
|
* Add a socket descriptor that is accepting connections. After this
|
||||||
* has been called, don't call server_socket_open(), because the
|
* has been called, don't call server_socket_open(), because the
|
||||||
|
Loading…
Reference in New Issue
Block a user