event/FullyBufferedSocket: add "noexcept"
This commit is contained in:
parent
a17a481e30
commit
451fbbcea1
@ -26,7 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
FullyBufferedSocket::ssize_t
|
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);
|
const auto nbytes = GetSocket().Write((const char *)data, length);
|
||||||
if (gcc_unlikely(nbytes < 0)) {
|
if (gcc_unlikely(nbytes < 0)) {
|
||||||
@ -47,7 +47,7 @@ FullyBufferedSocket::DirectWrite(const void *data, size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FullyBufferedSocket::Flush()
|
FullyBufferedSocket::Flush() noexcept
|
||||||
{
|
{
|
||||||
assert(IsDefined());
|
assert(IsDefined());
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ FullyBufferedSocket::Flush()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FullyBufferedSocket::Write(const void *data, size_t length)
|
FullyBufferedSocket::Write(const void *data, size_t length) noexcept
|
||||||
{
|
{
|
||||||
assert(IsDefined());
|
assert(IsDefined());
|
||||||
|
|
||||||
|
@ -33,20 +33,20 @@ class FullyBufferedSocket : protected BufferedSocket, private IdleMonitor {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FullyBufferedSocket(SocketDescriptor _fd, EventLoop &_loop,
|
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),
|
:BufferedSocket(_fd, _loop), IdleMonitor(_loop),
|
||||||
output(normal_size, peak_size) {
|
output(normal_size, peak_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
using BufferedSocket::IsDefined;
|
using BufferedSocket::IsDefined;
|
||||||
|
|
||||||
void Close() {
|
void Close() noexcept {
|
||||||
IdleMonitor::Cancel();
|
IdleMonitor::Cancel();
|
||||||
BufferedSocket::Close();
|
BufferedSocket::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ssize_t DirectWrite(const void *data, size_t length);
|
ssize_t DirectWrite(const void *data, size_t length) noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -54,12 +54,12 @@ protected:
|
|||||||
*
|
*
|
||||||
* @return false if the socket has been closed
|
* @return false if the socket has been closed
|
||||||
*/
|
*/
|
||||||
bool Flush();
|
bool Flush() noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return false if the socket has been closed
|
* @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 */
|
/* virtual methods from class SocketMonitor */
|
||||||
bool OnSocketReady(unsigned flags) noexcept override;
|
bool OnSocketReady(unsigned flags) noexcept override;
|
||||||
|
Loading…
Reference in New Issue
Block a user