event/SocketMonitor: rename Get() to GetSocket()
This commit is contained in:
parent
59a8836924
commit
7e16ac305d
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
return fd.IsDefined();
|
||||
}
|
||||
|
||||
SocketDescriptor Get() const noexcept {
|
||||
SocketDescriptor GetSocket() const noexcept {
|
||||
assert(IsDefined());
|
||||
|
||||
return fd;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user