Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix poller compatibility mode KIKIMR-20604 #765

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions ydb/library/actors/interconnect/poller_actor_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,24 @@ namespace NActors {
static constexpr ui32 fullWrite = WriteExpected | WriteHit;
bool read = (updated & fullRead) == fullRead;
bool write = (updated & fullWrite) == fullWrite;
if (checkQueues) {
const bool queryRead = updated & ReadExpected && !read;
const bool queryWrite = updated & WriteExpected && !write;
if (queryRead || queryWrite) {
pollfd fd;
fd.fd = record->Socket->GetDescriptor();
fd.events = (queryRead ? POLLIN | POLLRDHUP : 0) | (queryWrite ? POLLOUT : 0);
if (poll(&fd, 1, 0) != -1) {
read |= queryRead && fd.revents & (POLLIN | POLLHUP | POLLRDHUP | POLLERR);
write |= queryWrite && fd.revents & (POLLOUT | POLLERR);
}
}
}
updated &= ~((read ? fullRead : 0) | (write ? fullWrite : 0));
if (record->Flags.compare_exchange_weak(flags, updated, std::memory_order_acq_rel)) {
if (suppressNotify) {
return read || write;
} else {
if (checkQueues) {
pollfd fd;
fd.fd = record->Socket->GetDescriptor();
const bool queryRead = updated & ReadExpected && !read;
const bool queryWrite = updated & WriteExpected && !write;
if (queryRead || queryWrite) {
fd.events = (queryRead ? POLLIN : 0) | (queryWrite ? POLLOUT : 0);
if (poll(&fd, 1, 0) != -1) {
read = queryRead && fd.revents & (POLLIN | POLLHUP | POLLRDHUP | POLLERR);
write = queryWrite && fd.revents & (POLLOUT | POLLERR);
}
}
}
Notify(record, read, write);
return false;
}
Expand Down
Loading