This is an automated email from the ASF dual-hosted git repository. wwbmmm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push: new 552bd306 Remove implementation specific function name of EventDispatcher (#2462) 552bd306 is described below commit 552bd30640ba5a65c7d988e5a55c623d833e35b1 Author: Divyansh200102 <146909065+divyansh200...@users.noreply.github.com> AuthorDate: Thu Feb 1 14:59:38 2024 +0530 Remove implementation specific function name of EventDispatcher (#2462) * Remove implementation specific function name of EventDispatcher * Deregister to Unregister * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp * Update socket.cpp --- src/brpc/event_dispatcher.h | 4 ++-- src/brpc/event_dispatcher_epoll.cpp | 4 ++-- src/brpc/event_dispatcher_kqueue.cpp | 4 ++-- src/brpc/socket.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/brpc/event_dispatcher.h b/src/brpc/event_dispatcher.h index d18c213e..0de74df6 100644 --- a/src/brpc/event_dispatcher.h +++ b/src/brpc/event_dispatcher.h @@ -64,12 +64,12 @@ public: // be used instead of EPOLL_CTL_ADD. When event arrives, // `Socket::HandleEpollOut' will be called with `socket_id' // Returns 0 on success, -1 otherwise and errno is set - int AddEpollOut(SocketId socket_id, int fd, bool pollin); + int RegisterEvent(SocketId socket_id, int fd, bool pollin); // Remove EPOLLOUT event on `fd'. If `pollin' is true, EPOLLIN event // will be kept and EPOLL_CTL_MOD will be used instead of EPOLL_CTL_DEL // Returns 0 on success, -1 otherwise and errno is set - int RemoveEpollOut(SocketId socket_id, int fd, bool pollin); + int UnregisterEvent(SocketId socket_id, int fd, bool pollin); private: DISALLOW_COPY_AND_ASSIGN(EventDispatcher); diff --git a/src/brpc/event_dispatcher_epoll.cpp b/src/brpc/event_dispatcher_epoll.cpp index 07d485e6..1ac7647d 100644 --- a/src/brpc/event_dispatcher_epoll.cpp +++ b/src/brpc/event_dispatcher_epoll.cpp @@ -111,7 +111,7 @@ void EventDispatcher::Join() { } } -int EventDispatcher::AddEpollOut(SocketId socket_id, int fd, bool pollin) { +int EventDispatcher::RegisterEvent(SocketId socket_id, int fd, bool pollin) { if (_epfd < 0) { errno = EINVAL; return -1; @@ -138,7 +138,7 @@ int EventDispatcher::AddEpollOut(SocketId socket_id, int fd, bool pollin) { return 0; } -int EventDispatcher::RemoveEpollOut(SocketId socket_id, +int EventDispatcher::UnregisterEvent(SocketId socket_id, int fd, bool pollin) { if (pollin) { epoll_event evt; diff --git a/src/brpc/event_dispatcher_kqueue.cpp b/src/brpc/event_dispatcher_kqueue.cpp index 614cd3bc..fa52a204 100644 --- a/src/brpc/event_dispatcher_kqueue.cpp +++ b/src/brpc/event_dispatcher_kqueue.cpp @@ -113,7 +113,7 @@ void EventDispatcher::Join() { } } -int EventDispatcher::AddEpollOut(SocketId socket_id, int fd, bool pollin) { +int EventDispatcher::RegisterEvent(SocketId socket_id, int fd, bool pollin) { if (_epfd < 0) { errno = EINVAL; return -1; @@ -136,7 +136,7 @@ int EventDispatcher::AddEpollOut(SocketId socket_id, int fd, bool pollin) { return 0; } -int EventDispatcher::RemoveEpollOut(SocketId socket_id, +int EventDispatcher::UnregisterEvent(SocketId socket_id, int fd, bool pollin) { struct kevent evt; EV_SET(&evt, fd, EVFILT_WRITE, EV_DELETE, 0, 0, NULL); diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp index 9248dd18..1f9b2a2e 100644 --- a/src/brpc/socket.cpp +++ b/src/brpc/socket.cpp @@ -1234,7 +1234,7 @@ int Socket::WaitEpollOut(int fd, bool pollin, const timespec* abstime) { // health checker which called `SetFailed' before const int expected_val = _epollout_butex->load(butil::memory_order_relaxed); EventDispatcher& edisp = GetGlobalEventDispatcher(fd, _bthread_tag); - if (edisp.AddEpollOut(id(), fd, pollin) != 0) { + if (edisp.RegisterEvent(id(), fd, pollin) != 0) { return -1; } @@ -1246,7 +1246,7 @@ int Socket::WaitEpollOut(int fd, bool pollin, const timespec* abstime) { } // Ignore return value since `fd' might have been removed // by `RemoveConsumer' in `SetFailed' - butil::ignore_result(edisp.RemoveEpollOut(id(), fd, pollin)); + butil::ignore_result(edisp.UnregisterEvent(id(), fd, pollin)); errno = saved_errno; // Could be writable or spurious wakeup (by former epollout) return rc; @@ -1309,7 +1309,7 @@ int Socket::Connect(const timespec* abstime, // Add `sockfd' into epoll so that `HandleEpollOutRequest' will // be called with `req' when epoll event reaches - if (GetGlobalEventDispatcher(sockfd, _bthread_tag).AddEpollOut(connect_id, sockfd, false) != + if (GetGlobalEventDispatcher(sockfd, _bthread_tag).RegisterEvent(connect_id, sockfd, false) != 0) { const int saved_errno = errno; PLOG(WARNING) << "Fail to add fd=" << sockfd << " into epoll"; @@ -1450,7 +1450,7 @@ int Socket::HandleEpollOutRequest(int error_code, EpollOutRequest* req) { } // We've got the right to call user callback // The timer will be removed inside destructor of EpollOutRequest - GetGlobalEventDispatcher(req->fd, _bthread_tag).RemoveEpollOut(id(), req->fd, false); + GetGlobalEventDispatcher(req->fd, _bthread_tag).UnregisterEvent(id(), req->fd, false); return req->on_epollout_event(req->fd, error_code, req->data); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org