summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-10-30 19:57:39 +0100
committerMax Kellermann <max@musicpd.org>2018-10-30 19:57:39 +0100
commit5fb21fbdb1290a1adc0130cdb7997a420ed679e3 (patch)
tree7759f51a1b735ce278de65e081342c6ac16f4744 /src
parentf5857c4689b0717ca33d7ab994e406d80275e7b6 (diff)
event/ServerSocket: add `noexcept`
Diffstat (limited to 'src')
-rw-r--r--src/event/ServerSocket.cxx22
-rw-r--r--src/event/ServerSocket.hxx16
2 files changed, 19 insertions, 19 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx
index e2a97f5cb..55b154f44 100644
--- a/src/event/ServerSocket.cxx
+++ b/src/event/ServerSocket.cxx
@@ -67,7 +67,7 @@ public:
template<typename A>
OneServerSocket(EventLoop &_loop, ServerSocket &_parent,
unsigned _serial,
- A &&_address)
+ A &&_address) noexcept
:SocketMonitor(_loop),
parent(_parent), serial(_serial),
#ifdef HAVE_UN
@@ -80,17 +80,17 @@ public:
OneServerSocket(const OneServerSocket &other) = delete;
OneServerSocket &operator=(const OneServerSocket &other) = delete;
- ~OneServerSocket() {
+ ~OneServerSocket() noexcept {
if (IsDefined())
Close();
}
- unsigned GetSerial() const {
+ unsigned GetSerial() const noexcept {
return serial;
}
#ifdef HAVE_UN
- void SetPath(AllocatedPath &&_path) {
+ void SetPath(AllocatedPath &&_path) noexcept {
assert(path.IsNull());
path = std::move(_path);
@@ -197,12 +197,12 @@ OneServerSocket::Open()
SetFD(_fd.Release());
}
-ServerSocket::ServerSocket(EventLoop &_loop)
+ServerSocket::ServerSocket(EventLoop &_loop) noexcept
:loop(_loop), next_serial(1) {}
/* this is just here to allow the OneServerSocket forward
declaration */
-ServerSocket::~ServerSocket() {}
+ServerSocket::~ServerSocket() noexcept = default;
void
ServerSocket::Open()
@@ -265,7 +265,7 @@ ServerSocket::Open()
}
void
-ServerSocket::Close()
+ServerSocket::Close() noexcept
{
for (auto &i : sockets)
if (i.IsDefined())
@@ -273,7 +273,7 @@ ServerSocket::Close()
}
OneServerSocket &
-ServerSocket::AddAddress(SocketAddress address)
+ServerSocket::AddAddress(SocketAddress address) noexcept
{
sockets.emplace_back(loop, *this, next_serial,
address);
@@ -282,7 +282,7 @@ ServerSocket::AddAddress(SocketAddress address)
}
OneServerSocket &
-ServerSocket::AddAddress(AllocatedSocketAddress &&address)
+ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept
{
sockets.emplace_back(loop, *this, next_serial,
std::move(address));
@@ -308,7 +308,7 @@ ServerSocket::AddFD(int _fd)
#ifdef HAVE_TCP
inline void
-ServerSocket::AddPortIPv4(unsigned port)
+ServerSocket::AddPortIPv4(unsigned port) noexcept
{
AddAddress(IPv4Address(port));
}
@@ -316,7 +316,7 @@ ServerSocket::AddPortIPv4(unsigned port)
#ifdef HAVE_IPV6
inline void
-ServerSocket::AddPortIPv6(unsigned port)
+ServerSocket::AddPortIPv6(unsigned port) noexcept
{
struct sockaddr_in6 sin;
memset(&sin, 0, sizeof(sin));
diff --git a/src/event/ServerSocket.hxx b/src/event/ServerSocket.hxx
index 6ad1ab8a3..fc1ff7510 100644
--- a/src/event/ServerSocket.hxx
+++ b/src/event/ServerSocket.hxx
@@ -42,30 +42,30 @@ class ServerSocket {
unsigned next_serial;
public:
- ServerSocket(EventLoop &_loop);
- ~ServerSocket();
+ ServerSocket(EventLoop &_loop) noexcept;
+ ~ServerSocket() noexcept;
- EventLoop &GetEventLoop() {
+ EventLoop &GetEventLoop() const noexcept {
return loop;
}
private:
- OneServerSocket &AddAddress(SocketAddress address);
- OneServerSocket &AddAddress(AllocatedSocketAddress &&address);
+ OneServerSocket &AddAddress(SocketAddress address) noexcept;
+ OneServerSocket &AddAddress(AllocatedSocketAddress &&address) noexcept;
/**
* Add a listener on a port on all IPv4 interfaces.
*
* @param port the TCP port
*/
- void AddPortIPv4(unsigned port);
+ void AddPortIPv4(unsigned port) noexcept;
/**
* Add a listener on a port on all IPv6 interfaces.
*
* @param port the TCP port
*/
- void AddPortIPv6(unsigned port);
+ void AddPortIPv6(unsigned port) noexcept;
public:
/**
@@ -118,7 +118,7 @@ public:
*/
void Open();
- void Close();
+ void Close() noexcept;
protected:
virtual void OnAccept(UniqueSocketDescriptor fd,