diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 89a46b5be..47b0027d0 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -142,7 +142,7 @@ private: void Disconnect(); /* virtual methods from SocketMonitor */ - bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; /* virtual methods from IdleMonitor */ void OnIdle() override; @@ -459,7 +459,7 @@ ProxyDatabase::Disconnect() } bool -ProxyDatabase::OnSocketReady(gcc_unused unsigned flags) +ProxyDatabase::OnSocketReady(gcc_unused unsigned flags) noexcept { assert(connection != nullptr); diff --git a/src/db/update/InotifySource.cxx b/src/db/update/InotifySource.cxx index a8ce35ad7..a5eafaa99 100644 --- a/src/db/update/InotifySource.cxx +++ b/src/db/update/InotifySource.cxx @@ -32,7 +32,7 @@ #include bool -InotifySource::OnSocketReady(gcc_unused unsigned flags) +InotifySource::OnSocketReady(gcc_unused unsigned flags) noexcept { uint8_t buffer[4096]; static_assert(sizeof(buffer) >= sizeof(struct inotify_event) + NAME_MAX + 1, diff --git a/src/db/update/InotifySource.hxx b/src/db/update/InotifySource.hxx index 3cf6d7a5d..a1c8a0374 100644 --- a/src/db/update/InotifySource.hxx +++ b/src/db/update/InotifySource.hxx @@ -66,7 +66,7 @@ public: void Remove(unsigned wd); private: - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; }; #endif diff --git a/src/event/BufferedSocket.cxx b/src/event/BufferedSocket.cxx index b13e9fded..d435ecaab 100644 --- a/src/event/BufferedSocket.cxx +++ b/src/event/BufferedSocket.cxx @@ -99,7 +99,7 @@ BufferedSocket::ResumeInput() } bool -BufferedSocket::OnSocketReady(unsigned flags) +BufferedSocket::OnSocketReady(unsigned flags) noexcept { assert(IsDefined()); diff --git a/src/event/BufferedSocket.hxx b/src/event/BufferedSocket.hxx index 849229960..4c286406f 100644 --- a/src/event/BufferedSocket.hxx +++ b/src/event/BufferedSocket.hxx @@ -113,7 +113,8 @@ protected: virtual void OnSocketError(std::exception_ptr ep) = 0; virtual void OnSocketClosed() = 0; - virtual bool OnSocketReady(unsigned flags) override; + /* virtual methods from class SocketMonitor */ + bool OnSocketReady(unsigned flags) noexcept override; }; #endif diff --git a/src/event/FullyBufferedSocket.cxx b/src/event/FullyBufferedSocket.cxx index d11be29bd..6e1b1106b 100644 --- a/src/event/FullyBufferedSocket.cxx +++ b/src/event/FullyBufferedSocket.cxx @@ -93,7 +93,7 @@ FullyBufferedSocket::Write(const void *data, size_t length) } bool -FullyBufferedSocket::OnSocketReady(unsigned flags) +FullyBufferedSocket::OnSocketReady(unsigned flags) noexcept { if (flags & WRITE) { assert(!output.empty()); diff --git a/src/event/FullyBufferedSocket.hxx b/src/event/FullyBufferedSocket.hxx index 71fcb0c36..c7ed93465 100644 --- a/src/event/FullyBufferedSocket.hxx +++ b/src/event/FullyBufferedSocket.hxx @@ -61,7 +61,9 @@ protected: */ bool Write(const void *data, size_t length); - virtual bool OnSocketReady(unsigned flags) override; + /* virtual methods from class SocketMonitor */ + bool OnSocketReady(unsigned flags) noexcept override; + virtual void OnIdle() override; }; diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index e3ea891c4..92033e598 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -256,7 +256,7 @@ EventLoop::HandleDeferred() } bool -EventLoop::OnSocketReady(gcc_unused unsigned flags) +EventLoop::OnSocketReady(gcc_unused unsigned flags) noexcept { assert(IsInside()); diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index b76f4a762..eb8131609 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -188,7 +188,7 @@ private: */ void HandleDeferred(); - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; public: diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index fdf353bcc..ed83f1817 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -80,7 +80,7 @@ class MultiSocketMonitor : IdleMonitor } protected: - virtual bool OnSocketReady(unsigned flags) override { + bool OnSocketReady(unsigned flags) noexcept override { revents = flags; multi.SetReady(); return true; diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 667b6846b..40329038b 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -115,7 +115,7 @@ public: void Accept() noexcept; private: - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; }; static constexpr Domain server_socket_domain("server_socket"); @@ -169,7 +169,7 @@ OneServerSocket::Accept() noexcept } bool -OneServerSocket::OnSocketReady(gcc_unused unsigned flags) +OneServerSocket::OnSocketReady(gcc_unused unsigned flags) noexcept { Accept(); return true; diff --git a/src/event/SignalMonitor.cxx b/src/event/SignalMonitor.cxx index b3ef41ecc..36c00b450 100644 --- a/src/event/SignalMonitor.cxx +++ b/src/event/SignalMonitor.cxx @@ -81,7 +81,7 @@ public: #endif private: - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; }; /* this should be enough - is it? */ @@ -197,7 +197,7 @@ SignalMonitorRegister(int signo, SignalHandler handler) } bool -SignalMonitor::OnSocketReady(unsigned) +SignalMonitor::OnSocketReady(unsigned) noexcept { #ifdef USE_SIGNALFD int signo; diff --git a/src/event/SocketMonitor.cxx b/src/event/SocketMonitor.cxx index 52b554644..8479f12d0 100644 --- a/src/event/SocketMonitor.cxx +++ b/src/event/SocketMonitor.cxx @@ -30,7 +30,7 @@ #endif void -SocketMonitor::Dispatch(unsigned flags) +SocketMonitor::Dispatch(unsigned flags) noexcept { flags &= GetScheduledFlags(); @@ -38,14 +38,14 @@ SocketMonitor::Dispatch(unsigned flags) Cancel(); } -SocketMonitor::~SocketMonitor() +SocketMonitor::~SocketMonitor() noexcept { if (IsDefined()) Cancel(); } void -SocketMonitor::Open(SocketDescriptor _fd) +SocketMonitor::Open(SocketDescriptor _fd) noexcept { assert(!fd.IsDefined()); assert(_fd.IsDefined()); @@ -54,7 +54,7 @@ SocketMonitor::Open(SocketDescriptor _fd) } SocketDescriptor -SocketMonitor::Steal() +SocketMonitor::Steal() noexcept { assert(IsDefined()); @@ -64,7 +64,7 @@ SocketMonitor::Steal() } void -SocketMonitor::Abandon() +SocketMonitor::Abandon() noexcept { assert(IsDefined()); @@ -73,13 +73,13 @@ SocketMonitor::Abandon() } void -SocketMonitor::Close() +SocketMonitor::Close() noexcept { Steal().Close(); } void -SocketMonitor::Schedule(unsigned flags) +SocketMonitor::Schedule(unsigned flags) noexcept { assert(IsDefined()); @@ -97,7 +97,7 @@ SocketMonitor::Schedule(unsigned flags) } SocketMonitor::ssize_t -SocketMonitor::Read(void *data, size_t length) +SocketMonitor::Read(void *data, size_t length) noexcept { assert(IsDefined()); @@ -110,7 +110,7 @@ SocketMonitor::Read(void *data, size_t length) } SocketMonitor::ssize_t -SocketMonitor::Write(const void *data, size_t length) +SocketMonitor::Write(const void *data, size_t length) noexcept { assert(IsDefined()); diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx index 913e7b7e2..3a944a838 100644 --- a/src/event/SocketMonitor.hxx +++ b/src/event/SocketMonitor.hxx @@ -61,82 +61,82 @@ public: typedef std::make_signed::type ssize_t; - explicit SocketMonitor(EventLoop &_loop) + explicit SocketMonitor(EventLoop &_loop) noexcept :loop(_loop) {} - SocketMonitor(SocketDescriptor _fd, EventLoop &_loop) + SocketMonitor(SocketDescriptor _fd, EventLoop &_loop) noexcept :fd(_fd), loop(_loop) {} - ~SocketMonitor(); + ~SocketMonitor() noexcept; - EventLoop &GetEventLoop() { + EventLoop &GetEventLoop() noexcept { return loop; } - bool IsDefined() const { + bool IsDefined() const noexcept { return fd.IsDefined(); } - SocketDescriptor Get() const { + SocketDescriptor Get() const noexcept { assert(IsDefined()); return fd; } - void Open(SocketDescriptor _fd); + void Open(SocketDescriptor _fd) noexcept; /** * "Steal" the socket descriptor. This abandons the socket * and returns it. */ - SocketDescriptor Steal(); + SocketDescriptor Steal() noexcept; /** * Somebody has closed the socket. Unregister this object. */ - void Abandon(); + void Abandon() noexcept; - void Close(); + void Close() noexcept; - unsigned GetScheduledFlags() const { + unsigned GetScheduledFlags() const noexcept { assert(IsDefined()); return scheduled_flags; } - void Schedule(unsigned flags); + void Schedule(unsigned flags) noexcept; - void Cancel() { + void Cancel() noexcept { Schedule(0); } - void ScheduleRead() { + void ScheduleRead() noexcept { Schedule(GetScheduledFlags() | READ | HANGUP | ERROR); } - void ScheduleWrite() { + void ScheduleWrite() noexcept { Schedule(GetScheduledFlags() | WRITE); } - void CancelRead() { + void CancelRead() noexcept { Schedule(GetScheduledFlags() & ~(READ|HANGUP|ERROR)); } - void CancelWrite() { + void CancelWrite() noexcept { Schedule(GetScheduledFlags() & ~WRITE); } - ssize_t Read(void *data, size_t length); - ssize_t Write(const void *data, size_t length); + ssize_t Read(void *data, size_t length) noexcept; + ssize_t Write(const void *data, size_t length) noexcept; protected: /** * @return false if the socket has been closed */ - virtual bool OnSocketReady(unsigned flags) = 0; + virtual bool OnSocketReady(unsigned flags) noexcept = 0; public: - void Dispatch(unsigned flags); + void Dispatch(unsigned flags) noexcept; }; #endif diff --git a/src/lib/curl/Global.cxx b/src/lib/curl/Global.cxx index fac252f34..de9d36b0e 100644 --- a/src/lib/curl/Global.cxx +++ b/src/lib/curl/Global.cxx @@ -65,7 +65,7 @@ public: curl_socket_t s, int action, void *userp, void *socketp) noexcept; - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; private: static constexpr int FlagsToCurlCSelect(unsigned flags) { @@ -145,7 +145,7 @@ CurlSocket::SocketFunction(gcc_unused CURL *easy, } bool -CurlSocket::OnSocketReady(unsigned flags) +CurlSocket::OnSocketReady(unsigned flags) noexcept { assert(GetEventLoop().IsInside()); diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index 934122edd..6a58c865a 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -446,7 +446,7 @@ NfsConnection::Service(unsigned flags) } bool -NfsConnection::OnSocketReady(unsigned flags) +NfsConnection::OnSocketReady(unsigned flags) noexcept { assert(GetEventLoop().IsInside()); assert(deferred_close.empty()); diff --git a/src/lib/nfs/Connection.hxx b/src/lib/nfs/Connection.hxx index 2cb7cd841..2e70cbfc5 100644 --- a/src/lib/nfs/Connection.hxx +++ b/src/lib/nfs/Connection.hxx @@ -230,7 +230,7 @@ private: int Service(unsigned flags); /* virtual methods from SocketMonitor */ - virtual bool OnSocketReady(unsigned flags) override; + bool OnSocketReady(unsigned flags) noexcept override; /* callback for #mount_timeout_event */ void OnMountTimeout(); diff --git a/src/output/plugins/httpd/HttpdClient.cxx b/src/output/plugins/httpd/HttpdClient.cxx index c62cd17e1..e9a626f1f 100644 --- a/src/output/plugins/httpd/HttpdClient.cxx +++ b/src/output/plugins/httpd/HttpdClient.cxx @@ -403,7 +403,7 @@ HttpdClient::PushMetaData(PagePtr page) } bool -HttpdClient::OnSocketReady(unsigned flags) +HttpdClient::OnSocketReady(unsigned flags) noexcept { if (!BufferedSocket::OnSocketReady(flags)) return false; diff --git a/src/output/plugins/httpd/HttpdClient.hxx b/src/output/plugins/httpd/HttpdClient.hxx index 128e17eeb..3c1049622 100644 --- a/src/output/plugins/httpd/HttpdClient.hxx +++ b/src/output/plugins/httpd/HttpdClient.hxx @@ -191,7 +191,9 @@ private: void ClearQueue(); protected: - virtual bool OnSocketReady(unsigned flags) override; + /* 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; diff --git a/src/zeroconf/AvahiPoll.cxx b/src/zeroconf/AvahiPoll.cxx index 6359e5843..d7c117711 100644 --- a/src/zeroconf/AvahiPoll.cxx +++ b/src/zeroconf/AvahiPoll.cxx @@ -69,8 +69,9 @@ public: delete w; } -protected: - virtual bool OnSocketReady(unsigned flags) { +private: + /* virtual methods from class SocketMonitor */ + bool OnSocketReady(unsigned flags) noexcept { received = ToAvahiWatchEvent(flags); callback(this, Get().Get(), received, userdata); received = AvahiWatchEvent(0); diff --git a/src/zeroconf/ZeroconfBonjour.cxx b/src/zeroconf/ZeroconfBonjour.cxx index 283b3893d..9125bf483 100644 --- a/src/zeroconf/ZeroconfBonjour.cxx +++ b/src/zeroconf/ZeroconfBonjour.cxx @@ -48,7 +48,8 @@ public: } protected: - virtual bool OnSocketReady(gcc_unused unsigned flags) override { + /* virtual methods from class SocketMonitor */ + bool OnSocketReady(gcc_unused unsigned flags) noexcept override { DNSServiceProcessResult(service_ref); return false; }