|
|
@ -309,7 +309,9 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) { |
|
|
|
|
|
|
|
|
|
|
|
struct epoll_event ev; |
|
|
|
struct epoll_event ev; |
|
|
|
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLOUT | EPOLLET); |
|
|
|
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLOUT | EPOLLET); |
|
|
|
/* Use the least significant bit of ev.data.ptr to store track_err. */ |
|
|
|
/* Use the least significant bit of ev.data.ptr to store track_err. We expect
|
|
|
|
|
|
|
|
* the addresses to be word aligned. We need to store track_err to avoid |
|
|
|
|
|
|
|
* synchronization issues when accessing it after receiving an event. */ |
|
|
|
ev.data.ptr = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_fd) | |
|
|
|
ev.data.ptr = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_fd) | |
|
|
|
(track_err ? 1 : 0)); |
|
|
|
(track_err ? 1 : 0)); |
|
|
|
if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) { |
|
|
|
if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) { |
|
|
@ -626,7 +628,7 @@ static grpc_error* process_epoll_events(grpc_pollset* pollset) { |
|
|
|
grpc_fd* fd = reinterpret_cast<grpc_fd*>( |
|
|
|
grpc_fd* fd = reinterpret_cast<grpc_fd*>( |
|
|
|
reinterpret_cast<intptr_t>(data_ptr) & ~static_cast<intptr_t>(1)); |
|
|
|
reinterpret_cast<intptr_t>(data_ptr) & ~static_cast<intptr_t>(1)); |
|
|
|
bool track_err = |
|
|
|
bool track_err = |
|
|
|
reinterpret_cast<intptr_t>(data_ptr) & ~static_cast<intptr_t>(1); |
|
|
|
reinterpret_cast<intptr_t>(data_ptr) & static_cast<intptr_t>(1); |
|
|
|
bool cancel = (ev->events & EPOLLHUP) != 0; |
|
|
|
bool cancel = (ev->events & EPOLLHUP) != 0; |
|
|
|
bool error = (ev->events & EPOLLERR) != 0; |
|
|
|
bool error = (ev->events & EPOLLERR) != 0; |
|
|
|
bool read_ev = (ev->events & (EPOLLIN | EPOLLPRI)) != 0; |
|
|
|
bool read_ev = (ev->events & (EPOLLIN | EPOLLPRI)) != 0; |
|
|
|