Ensure the Chttp2Connector is deleted under an ExecCtx.

PiperOrigin-RevId: 648531927
pull/37134/head
Vignesh Babu 5 months ago committed by Copybara-Service
parent 1e2292fdb1
commit 773325b6d8
  1. 16
      src/core/ext/transport/chttp2/client/chttp2_connector.cc

@ -158,13 +158,15 @@ void Chttp2Connector::OnHandshakeDone(absl::StatusOr<HandshakerArgs*> result) {
grpc_chttp2_transport_start_reading(
result_->transport, (*result)->read_buffer.c_slice_buffer(),
&on_receive_settings_, args_.interested_parties, nullptr);
timer_handle_ =
event_engine_->RunAfter(args_.deadline - Timestamp::Now(),
[self = RefAsSubclass<Chttp2Connector>()] {
ApplicationCallbackExecCtx callback_exec_ctx;
ExecCtx exec_ctx;
self->OnTimeout();
});
timer_handle_ = event_engine_->RunAfter(
args_.deadline - Timestamp::Now(),
[self = RefAsSubclass<Chttp2Connector>()]() mutable {
ApplicationCallbackExecCtx callback_exec_ctx;
ExecCtx exec_ctx;
self->OnTimeout();
// Ensure the Chttp2Connector is deleted under an ExecCtx.
self.reset();
});
} else {
// If the handshaking succeeded but there is no endpoint, then the
// handshaker may have handed off the connection to some external

Loading…
Cancel
Save