diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-20 10:42:17 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-12-20 10:42:17 +0100 |
commit | a17a481e30836cb594e9b23f8a3dd019b9f50048 (patch) | |
tree | 4e6363d8fdd694063c28b68dc961320ff715ec2e /src/event | |
parent | 5f9d4a02a5131cf05d14eb0285e893b3488221e5 (diff) |
event/BufferedSocket: add "noexcept"
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/BufferedSocket.cxx | 6 | ||||
-rw-r--r-- | src/event/BufferedSocket.hxx | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/event/BufferedSocket.cxx b/src/event/BufferedSocket.cxx index bf3605149..03acca2f5 100644 --- a/src/event/BufferedSocket.cxx +++ b/src/event/BufferedSocket.cxx @@ -25,7 +25,7 @@ #include <algorithm> BufferedSocket::ssize_t -BufferedSocket::DirectRead(void *data, size_t length) +BufferedSocket::DirectRead(void *data, size_t length) noexcept { const auto nbytes = GetSocket().Read((char *)data, length); if (gcc_likely(nbytes > 0)) @@ -48,7 +48,7 @@ BufferedSocket::DirectRead(void *data, size_t length) } bool -BufferedSocket::ReadToBuffer() +BufferedSocket::ReadToBuffer() noexcept { assert(IsDefined()); @@ -63,7 +63,7 @@ BufferedSocket::ReadToBuffer() } bool -BufferedSocket::ResumeInput() +BufferedSocket::ResumeInput() noexcept { assert(IsDefined()); diff --git a/src/event/BufferedSocket.hxx b/src/event/BufferedSocket.hxx index b9dc344f6..6278d4c5c 100644 --- a/src/event/BufferedSocket.hxx +++ b/src/event/BufferedSocket.hxx @@ -38,7 +38,7 @@ class BufferedSocket : protected SocketMonitor { StaticFifoBuffer<uint8_t, 8192> input; public: - BufferedSocket(SocketDescriptor _fd, EventLoop &_loop) + BufferedSocket(SocketDescriptor _fd, EventLoop &_loop) noexcept :SocketMonitor(_fd, _loop) { ScheduleRead(); } @@ -47,20 +47,20 @@ public: using SocketMonitor::Close; private: - ssize_t DirectRead(void *data, size_t length); + ssize_t DirectRead(void *data, size_t length) noexcept; /** * Receive data from the socket to the input buffer. * * @return false if the socket has been closed */ - bool ReadToBuffer(); + bool ReadToBuffer() noexcept; protected: /** * @return false if the socket has been closed */ - bool ResumeInput(); + bool ResumeInput() noexcept; /** * Mark a portion of the input buffer "consumed". Only @@ -68,7 +68,7 @@ protected: * does not invalidate the pointer passed to OnSocketInput() * yet. */ - void ConsumeInput(size_t nbytes) { + void ConsumeInput(size_t nbytes) noexcept { assert(IsDefined()); input.Consume(nbytes); @@ -107,10 +107,10 @@ protected: * buffer may be modified by the method while it processes the * data */ - virtual InputResult OnSocketInput(void *data, size_t length) = 0; + virtual InputResult OnSocketInput(void *data, size_t length) noexcept = 0; - virtual void OnSocketError(std::exception_ptr ep) = 0; - virtual void OnSocketClosed() = 0; + virtual void OnSocketError(std::exception_ptr ep) noexcept = 0; + virtual void OnSocketClosed() noexcept = 0; /* virtual methods from class SocketMonitor */ bool OnSocketReady(unsigned flags) noexcept override; |