event/BufferedSocket: add "noexcept"
This commit is contained in:
parent
5f9d4a02a5
commit
a17a481e30
@ -226,9 +226,9 @@ public:
|
||||
|
||||
private:
|
||||
/* virtual methods from class BufferedSocket */
|
||||
InputResult OnSocketInput(void *data, size_t length) override;
|
||||
void OnSocketError(std::exception_ptr ep) override;
|
||||
void OnSocketClosed() override;
|
||||
InputResult OnSocketInput(void *data, size_t length) noexcept override;
|
||||
void OnSocketError(std::exception_ptr ep) noexcept override;
|
||||
void OnSocketClosed() noexcept override;
|
||||
|
||||
/* callback for TimerEvent */
|
||||
void OnTimeout() noexcept;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "Log.hxx"
|
||||
|
||||
void
|
||||
Client::OnSocketError(std::exception_ptr ep)
|
||||
Client::OnSocketError(std::exception_ptr ep) noexcept
|
||||
{
|
||||
FormatError(ep, "error on client %d", num);
|
||||
|
||||
@ -30,7 +30,7 @@ Client::OnSocketError(std::exception_ptr ep)
|
||||
}
|
||||
|
||||
void
|
||||
Client::OnSocketClosed()
|
||||
Client::OnSocketClosed() noexcept
|
||||
{
|
||||
SetExpired();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <string.h>
|
||||
|
||||
BufferedSocket::InputResult
|
||||
Client::OnSocketInput(void *data, size_t length)
|
||||
Client::OnSocketInput(void *data, size_t length) noexcept
|
||||
{
|
||||
char *p = (char *)data;
|
||||
char *newline = (char *)memchr(p, '\n', length);
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
|
@ -408,7 +408,7 @@ HttpdClient::OnSocketReady(unsigned flags) noexcept
|
||||
}
|
||||
|
||||
BufferedSocket::InputResult
|
||||
HttpdClient::OnSocketInput(void *data, size_t length)
|
||||
HttpdClient::OnSocketInput(void *data, size_t length) noexcept
|
||||
{
|
||||
if (state == State::RESPONSE) {
|
||||
LogWarning(httpd_output_domain,
|
||||
@ -449,13 +449,13 @@ HttpdClient::OnSocketInput(void *data, size_t length)
|
||||
}
|
||||
|
||||
void
|
||||
HttpdClient::OnSocketError(std::exception_ptr ep)
|
||||
HttpdClient::OnSocketError(std::exception_ptr ep) noexcept
|
||||
{
|
||||
LogError(ep);
|
||||
}
|
||||
|
||||
void
|
||||
HttpdClient::OnSocketClosed()
|
||||
HttpdClient::OnSocketClosed() noexcept
|
||||
{
|
||||
LockClose();
|
||||
}
|
||||
|
@ -194,9 +194,9 @@ protected:
|
||||
/* virtual methods from class SocketMonitor */
|
||||
bool OnSocketReady(unsigned flags) noexcept override;
|
||||
|
||||
virtual InputResult OnSocketInput(void *data, size_t length) override;
|
||||
void OnSocketError(std::exception_ptr ep) override;
|
||||
virtual void OnSocketClosed() override;
|
||||
InputResult OnSocketInput(void *data, size_t length) noexcept override;
|
||||
void OnSocketError(std::exception_ptr ep) noexcept override;
|
||||
void OnSocketClosed() noexcept override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user