From 7e16ac305d403e640a540fe8ebf00f14b8d32b22 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Nov 2017 20:34:45 +0100 Subject: [PATCH] event/SocketMonitor: rename Get() to GetSocket() --- src/db/update/InotifySource.cxx | 6 +++--- src/event/MultiSocketMonitor.hxx | 6 +++--- src/event/ServerSocket.cxx | 2 +- src/event/SocketMonitor.cxx | 4 ++-- src/event/SocketMonitor.hxx | 2 +- src/lib/curl/Global.cxx | 2 +- src/zeroconf/AvahiPoll.cxx | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/db/update/InotifySource.cxx b/src/db/update/InotifySource.cxx index a5eafaa99..e04461ca7 100644 --- a/src/db/update/InotifySource.cxx +++ b/src/db/update/InotifySource.cxx @@ -38,7 +38,7 @@ InotifySource::OnSocketReady(gcc_unused unsigned flags) noexcept static_assert(sizeof(buffer) >= sizeof(struct inotify_event) + NAME_MAX + 1, "inotify buffer too small"); - auto ifd = Get().ToFileDescriptor(); + auto ifd = GetSocket().ToFileDescriptor(); ssize_t nbytes = ifd.Read(buffer, sizeof(buffer)); if (nbytes < 0) FatalSystemError("Failed to read from inotify"); @@ -90,7 +90,7 @@ InotifySource::InotifySource(EventLoop &_loop, int InotifySource::Add(const char *path_fs, unsigned mask) { - auto ifd = Get().ToFileDescriptor(); + auto ifd = GetSocket().ToFileDescriptor(); int wd = inotify_add_watch(ifd.Get(), path_fs, mask); if (wd < 0) throw MakeErrno("inotify_add_watch() has failed"); @@ -101,7 +101,7 @@ InotifySource::Add(const char *path_fs, unsigned mask) void InotifySource::Remove(unsigned wd) { - auto ifd = Get().ToFileDescriptor(); + auto ifd = GetSocket().ToFileDescriptor(); int ret = inotify_rm_watch(ifd.Get(), wd); if (ret < 0 && errno != EINVAL) LogErrno(inotify_domain, "inotify_rm_watch() has failed"); diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index ed83f1817..adae3cb49 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -58,8 +58,8 @@ class MultiSocketMonitor : IdleMonitor Schedule(events); } - SocketDescriptor GetFD() const { - return SocketMonitor::Get(); + SocketDescriptor GetSocket() const { + return SocketMonitor::GetSocket(); } unsigned GetEvents() const { @@ -174,7 +174,7 @@ public: i != end; i = std::next(prev)) { assert(i->GetEvents() != 0); - unsigned events = e(i->GetFD()); + unsigned events = e(i->GetSocket()); if (events != 0) { i->SetEvents(events); prev = i; diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 40329038b..b0fbe94d9 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -149,7 +149,7 @@ inline void OneServerSocket::Accept() noexcept { StaticSocketAddress peer_address; - UniqueSocketDescriptor peer_fd(Get().AcceptNonBlock(peer_address)); + UniqueSocketDescriptor peer_fd(GetSocket().AcceptNonBlock(peer_address)); if (!peer_fd.IsDefined()) { const SocketErrorMessage msg; FormatError(server_socket_domain, diff --git a/src/event/SocketMonitor.cxx b/src/event/SocketMonitor.cxx index 8479f12d0..36cb7cfda 100644 --- a/src/event/SocketMonitor.cxx +++ b/src/event/SocketMonitor.cxx @@ -106,7 +106,7 @@ SocketMonitor::Read(void *data, size_t length) noexcept flags |= MSG_DONTWAIT; #endif - return recv(Get().Get(), (char *)data, length, flags); + return recv(GetSocket().Get(), (char *)data, length, flags); } SocketMonitor::ssize_t @@ -122,5 +122,5 @@ SocketMonitor::Write(const void *data, size_t length) noexcept flags |= MSG_DONTWAIT; #endif - return send(Get().Get(), (const char *)data, length, flags); + return send(GetSocket().Get(), (const char *)data, length, flags); } diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx index 3a944a838..526de734e 100644 --- a/src/event/SocketMonitor.hxx +++ b/src/event/SocketMonitor.hxx @@ -77,7 +77,7 @@ public: return fd.IsDefined(); } - SocketDescriptor Get() const noexcept { + SocketDescriptor GetSocket() const noexcept { assert(IsDefined()); return fd; diff --git a/src/lib/curl/Global.cxx b/src/lib/curl/Global.cxx index de9d36b0e..60ae4e588 100644 --- a/src/lib/curl/Global.cxx +++ b/src/lib/curl/Global.cxx @@ -149,7 +149,7 @@ CurlSocket::OnSocketReady(unsigned flags) noexcept { assert(GetEventLoop().IsInside()); - global.SocketAction(Get().Get(), FlagsToCurlCSelect(flags)); + global.SocketAction(GetSocket().Get(), FlagsToCurlCSelect(flags)); return true; } diff --git a/src/zeroconf/AvahiPoll.cxx b/src/zeroconf/AvahiPoll.cxx index d7c117711..70fa8d4e1 100644 --- a/src/zeroconf/AvahiPoll.cxx +++ b/src/zeroconf/AvahiPoll.cxx @@ -73,7 +73,7 @@ private: /* virtual methods from class SocketMonitor */ bool OnSocketReady(unsigned flags) noexcept { received = ToAvahiWatchEvent(flags); - callback(this, Get().Get(), received, userdata); + callback(this, GetSocket().Get(), received, userdata); received = AvahiWatchEvent(0); return true; }