Skip to content

Commit

Permalink
fixup: sanity
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneo committed Dec 10, 2024
1 parent fd59f4f commit 6512c35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/core/lib/event_engine/posix_engine/posix_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,16 +656,16 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
impl_->MaybeShutdown(absl::FailedPreconditionError("Endpoint closing"),
[on_release = std::move(on_release_fd),
poller](absl::StatusOr<FileDescriptor> fd) mutable {
if (fd.ok()) {
auto locked_fd =
poller->GetSystemApi()->Lock(*fd);
if (!locked_fd.ok()) {
on_release(std::move(locked_fd).status());
}
on_release(locked_fd->fd());
} else {
if (!fd.ok()) {
on_release(std::move(fd).status());
return;
}
auto locked_fd = poller->GetSystemApi()->Lock(*fd);
if (!locked_fd.ok()) {
on_release(std::move(locked_fd).status());
return;
}
on_release(locked_fd->fd());
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/lib/event_engine/posix_engine/posix_system_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,21 @@ namespace {
class LocksState {
public:
void Lock(const SystemApi* system_api, int fd) {
#ifdef GPR_ABSEIL_SYNC
if (++counters_[system_api] == 1) {
system_api->ReaderLock();
}
LOG_EVERY_N(INFO, 10) << "Locks: " << counters_[system_api];
#endif
}

void Unlock(const SystemApi* system_api, int fd) {
#ifdef GPR_ABSEIL_SYNC
CHECK_GE(counters_[system_api], 0);
if (--counters_[system_api] == 0) {
system_api->ReaderUnlock();
}
#endif
}

private:
Expand Down
2 changes: 1 addition & 1 deletion test/core/event_engine/posix/posix_system_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ TEST(PosixSystemApiTest, PosixLevel) {
::testing::ElementsAreArray(buf));
}

TEST(PosixSystemApiTest, DISABLED_Incomplete_EventEndpointLevel) {
TEST(PosixSystemApiTest, DISABLED_IncompleteEventEndpointLevel) {
std::string target_addr = absl::StrCat(
"ipv6:[::1]:", std::to_string(grpc_pick_unused_port_or_die()));
auto address = URIToResolvedAddress(target_addr);
Expand Down

0 comments on commit 6512c35

Please sign in to comment.