summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-20 10:38:29 +0100
committerMax Kellermann <max@musicpd.org>2017-12-20 10:38:29 +0100
commit5f9d4a02a5131cf05d14eb0285e893b3488221e5 (patch)
tree428a98601a4d568cbf2e1c50a5b4074331e0f2fa
parent7094d8895896ae20cf082b95464d2ff9debe1f05 (diff)
client/*: add "noexcept"
-rw-r--r--src/client/Client.hxx36
-rw-r--r--src/client/ClientExpire.cxx4
-rw-r--r--src/client/ClientIdle.cxx6
-rw-r--r--src/client/ClientNew.cxx6
-rw-r--r--src/client/ClientSubscribe.cxx8
5 files changed, 30 insertions, 30 deletions
diff --git a/src/client/Client.hxx b/src/client/Client.hxx
index 5efe45af5..d6028658f 100644
--- a/src/client/Client.hxx
+++ b/src/client/Client.hxx
@@ -97,14 +97,14 @@ public:
std::list<ClientMessage> messages;
Client(EventLoop &loop, Partition &partition,
- UniqueSocketDescriptor fd, int uid, int num);
+ UniqueSocketDescriptor fd, int uid, int num) noexcept;
- ~Client() {
+ ~Client() noexcept {
if (FullyBufferedSocket::IsDefined())
FullyBufferedSocket::Close();
}
- bool IsConnected() const {
+ bool IsConnected() const noexcept {
return FullyBufferedSocket::IsDefined();
}
@@ -113,8 +113,8 @@ public:
return !FullyBufferedSocket::IsDefined();
}
- void Close();
- void SetExpired();
+ void Close() noexcept;
+ void SetExpired() noexcept;
bool Write(const void *data, size_t length);
@@ -127,7 +127,7 @@ public:
* returns the uid of the client process, or a negative value
* if the uid is unknown
*/
- int GetUID() const {
+ int GetUID() const noexcept {
return uid;
}
@@ -135,24 +135,24 @@ public:
* Is this client running on the same machine, connected with
* a local (UNIX domain) socket?
*/
- bool IsLocal() const {
+ bool IsLocal() const noexcept {
return uid >= 0;
}
- unsigned GetPermission() const {
+ unsigned GetPermission() const noexcept {
return permission;
}
- void SetPermission(unsigned _permission) {
+ void SetPermission(unsigned _permission) noexcept {
permission = _permission;
}
/**
* Send "idle" response to this client.
*/
- void IdleNotify();
- void IdleAdd(unsigned flags);
- bool IdleWait(unsigned flags);
+ void IdleNotify() noexcept;
+ void IdleAdd(unsigned flags) noexcept;
+ bool IdleWait(unsigned flags) noexcept;
enum class SubscribeResult {
/** success */
@@ -173,10 +173,10 @@ public:
return subscriptions.find(channel_name) != subscriptions.end();
}
- SubscribeResult Subscribe(const char *channel);
- bool Unsubscribe(const char *channel);
- void UnsubscribeAll();
- bool PushMessage(const ClientMessage &msg);
+ SubscribeResult Subscribe(const char *channel) noexcept;
+ bool Unsubscribe(const char *channel) noexcept;
+ void UnsubscribeAll() noexcept;
+ bool PushMessage(const ClientMessage &msg) noexcept;
/**
* Is this client allowed to use the specified local file?
@@ -231,7 +231,7 @@ private:
void OnSocketClosed() override;
/* callback for TimerEvent */
- void OnTimeout();
+ void OnTimeout() noexcept;
};
void
@@ -239,7 +239,7 @@ client_manager_init();
void
client_new(EventLoop &loop, Partition &partition,
- UniqueSocketDescriptor fd, SocketAddress address, int uid);
+ UniqueSocketDescriptor fd, SocketAddress address, int uid) noexcept;
/**
* Write a printf-like formatted string to the client.
diff --git a/src/client/ClientExpire.cxx b/src/client/ClientExpire.cxx
index 4a02c64f4..e625f8b38 100644
--- a/src/client/ClientExpire.cxx
+++ b/src/client/ClientExpire.cxx
@@ -22,7 +22,7 @@
#include "Log.hxx"
void
-Client::SetExpired()
+Client::SetExpired() noexcept
{
if (IsExpired())
return;
@@ -32,7 +32,7 @@ Client::SetExpired()
}
void
-Client::OnTimeout()
+Client::OnTimeout() noexcept
{
if (!IsExpired()) {
assert(!idle_waiting);
diff --git a/src/client/ClientIdle.cxx b/src/client/ClientIdle.cxx
index b9f3abacb..13c71ba80 100644
--- a/src/client/ClientIdle.cxx
+++ b/src/client/ClientIdle.cxx
@@ -24,7 +24,7 @@
#include <assert.h>
void
-Client::IdleNotify()
+Client::IdleNotify() noexcept
{
assert(idle_waiting);
assert(idle_flags != 0);
@@ -46,7 +46,7 @@ Client::IdleNotify()
}
void
-Client::IdleAdd(unsigned flags)
+Client::IdleAdd(unsigned flags) noexcept
{
if (IsExpired())
return;
@@ -57,7 +57,7 @@ Client::IdleAdd(unsigned flags)
}
bool
-Client::IdleWait(unsigned flags)
+Client::IdleWait(unsigned flags) noexcept
{
assert(!idle_waiting);
diff --git a/src/client/ClientNew.cxx b/src/client/ClientNew.cxx
index 11b5bc76c..81aa79d79 100644
--- a/src/client/ClientNew.cxx
+++ b/src/client/ClientNew.cxx
@@ -42,7 +42,7 @@
static constexpr char GREETING[] = "OK MPD " PROTOCOL_VERSION "\n";
Client::Client(EventLoop &_loop, Partition &_partition,
- UniqueSocketDescriptor _fd, int _uid, int _num)
+ UniqueSocketDescriptor _fd, int _uid, int _num) noexcept
:FullyBufferedSocket(_fd.Release(), _loop,
16384, client_max_output_buffer_size),
timeout_event(_loop, BIND_THIS_METHOD(OnTimeout)),
@@ -56,7 +56,7 @@ Client::Client(EventLoop &_loop, Partition &_partition,
void
client_new(EventLoop &loop, Partition &partition,
- UniqueSocketDescriptor fd, SocketAddress address, int uid)
+ UniqueSocketDescriptor fd, SocketAddress address, int uid) noexcept
{
static unsigned int next_client_num;
const auto remote = ToString(address);
@@ -102,7 +102,7 @@ client_new(EventLoop &loop, Partition &partition,
}
void
-Client::Close()
+Client::Close() noexcept
{
partition->instance.client_list->Remove(*this);
diff --git a/src/client/ClientSubscribe.cxx b/src/client/ClientSubscribe.cxx
index dc7c31b44..e5769a551 100644
--- a/src/client/ClientSubscribe.cxx
+++ b/src/client/ClientSubscribe.cxx
@@ -25,7 +25,7 @@
#include <assert.h>
Client::SubscribeResult
-Client::Subscribe(const char *channel)
+Client::Subscribe(const char *channel) noexcept
{
assert(channel != nullptr);
@@ -47,7 +47,7 @@ Client::Subscribe(const char *channel)
}
bool
-Client::Unsubscribe(const char *channel)
+Client::Unsubscribe(const char *channel) noexcept
{
const auto i = subscriptions.find(channel);
if (i == subscriptions.end())
@@ -67,14 +67,14 @@ Client::Unsubscribe(const char *channel)
}
void
-Client::UnsubscribeAll()
+Client::UnsubscribeAll() noexcept
{
subscriptions.clear();
num_subscriptions = 0;
}
bool
-Client::PushMessage(const ClientMessage &msg)
+Client::PushMessage(const ClientMessage &msg) noexcept
{
if (messages.size() >= CLIENT_MAX_MESSAGES ||
!IsSubscribed(msg.GetChannel()))