Skip to content

Commit bc1e8df

Browse files
committed
Fix comment
1 parent 702ec55 commit bc1e8df

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/core/ext/transport/chttp2/server/chttp2_server.cc

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

0 commit comments

Comments
 (0)