From 015fd943446638de304cbfd3f23fa2f2e07321bd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sat, 16 Nov 2024 23:01:08 -0800 Subject: [PATCH] x --- src/core/BUILD | 1 + src/core/ext/transport/chaotic_good/server_transport.cc | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/BUILD b/src/core/BUILD index 8e63656298e..6121957b862 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -8190,6 +8190,7 @@ grpc_cc_library( "absl/random:bit_gen_ref", "absl/status", "absl/status:statusor", + "absl/cleanup", "absl/types:optional", "absl/types:variant", ], diff --git a/src/core/ext/transport/chaotic_good/server_transport.cc b/src/core/ext/transport/chaotic_good/server_transport.cc index 50c4f211345..fdf2a7a6f2f 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.cc +++ b/src/core/ext/transport/chaotic_good/server_transport.cc @@ -23,6 +23,7 @@ #include #include +#include "absl/cleanup/cleanup.h" #include "absl/log/check.h" #include "absl/log/log.h" #include "absl/random/bit_gen_ref.h" @@ -440,6 +441,12 @@ absl::Status ChaoticGoodServerTransport::NewStream( void ChaoticGoodServerTransport::PerformOp(grpc_transport_op* op) { RefCountedPtr cancelled_party; + bool close_outgoing_frames = false; + auto cleanup = absl::MakeCleanup([&close_outgoing_frames, this]() { + if (close_outgoing_frames) { + outgoing_frames_.MarkClosed(); + } + }); MutexLock lock(&mu_); bool did_stuff = false; if (op->start_connectivity_watch != nullptr) { @@ -461,7 +468,7 @@ void ChaoticGoodServerTransport::PerformOp(grpc_transport_op* op) { } if (!op->goaway_error.ok() || !op->disconnect_with_error.ok()) { cancelled_party = std::move(party_); - outgoing_frames_.MarkClosed(); + close_outgoing_frames = true; state_tracker_.SetState(GRPC_CHANNEL_SHUTDOWN, absl::UnavailableError("transport closed"), "transport closed");