client/*: add "noexcept"
This commit is contained in:
parent
7094d88958
commit
5f9d4a02a5
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Reference in New Issue