event/FullyBufferedSocket: add "noexcept"

This commit is contained in:
Max Kellermann 2017-12-20 10:44:47 +01:00
parent a17a481e30
commit 451fbbcea1
2 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@
#include <string.h>
FullyBufferedSocket::ssize_t
FullyBufferedSocket::DirectWrite(const void *data, size_t length)
FullyBufferedSocket::DirectWrite(const void *data, size_t length) noexcept
{
const auto nbytes = GetSocket().Write((const char *)data, length);
if (gcc_unlikely(nbytes < 0)) {
@ -47,7 +47,7 @@ FullyBufferedSocket::DirectWrite(const void *data, size_t length)
}
bool
FullyBufferedSocket::Flush()
FullyBufferedSocket::Flush() noexcept
{
assert(IsDefined());
@ -73,7 +73,7 @@ FullyBufferedSocket::Flush()
}
bool
FullyBufferedSocket::Write(const void *data, size_t length)
FullyBufferedSocket::Write(const void *data, size_t length) noexcept
{
assert(IsDefined());

View File

@ -33,20 +33,20 @@ class FullyBufferedSocket : protected BufferedSocket, private IdleMonitor {
public:
FullyBufferedSocket(SocketDescriptor _fd, EventLoop &_loop,
size_t normal_size, size_t peak_size=0)
size_t normal_size, size_t peak_size=0) noexcept
:BufferedSocket(_fd, _loop), IdleMonitor(_loop),
output(normal_size, peak_size) {
}
using BufferedSocket::IsDefined;
void Close() {
void Close() noexcept {
IdleMonitor::Cancel();
BufferedSocket::Close();
}
private:
ssize_t DirectWrite(const void *data, size_t length);
ssize_t DirectWrite(const void *data, size_t length) noexcept;
protected:
/**
@ -54,12 +54,12 @@ protected:
*
* @return false if the socket has been closed
*/
bool Flush();
bool Flush() noexcept;
/**
* @return false if the socket has been closed
*/
bool Write(const void *data, size_t length);
bool Write(const void *data, size_t length) noexcept;
/* virtual methods from class SocketMonitor */
bool OnSocketReady(unsigned flags) noexcept override;