Skip to content

Commit

Permalink
Fix poller compatibility mode KIKIMR-20604 (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvru authored Dec 28, 2023
1 parent 53259c9 commit 70cada1
Showing 1 changed file with 13 additions and 13 deletions.
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

0 comments on commit 70cada1

Please sign in to comment.