Fix comment

pull/37225/head
Yash Tibrewal 4 months ago
parent 702ec55c69
commit bc1e8dfd34
  1. 10
      src/core/ext/transport/chttp2/server/chttp2_server.cc

@ -866,10 +866,12 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
// connection manager has changed. // connection manager has changed.
if (!self->shutdown_ && self->is_serving_ && if (!self->shutdown_ && self->is_serving_ &&
connection_manager == self->connection_manager_) { connection_manager == self->connection_manager_) {
// This ref needs to be taken in the critical region after having made // The ref for both the listener and tcp_server need to be taken in the
// sure that the listener has not been Orphaned, so as to avoid // critical region after having made sure that the listener has not been
// heap-use-after-free issues where `Ref()` is invoked when the ref of // Orphaned, so as to avoid heap-use-after-free issues where `Ref()` is
// tcp_server_ has already reached 0. // invoked when the listener is already shutdown. Note that the listener
// holds a ref to the tcp_server but this ref is given away when the
// listener is orphaned (shutdown).
if (self->tcp_server_ != nullptr) { if (self->tcp_server_ != nullptr) {
grpc_tcp_server_ref(self->tcp_server_); grpc_tcp_server_ref(self->tcp_server_);
} }

Loading…
Cancel
Save