Copilot commented on code in PR #13780:
URL: https://github.com/apache/trafficserver/pull/13780#discussion_r4161260204


##########
src/proxy/http2/Http2Stream.cc:
##########
@@ -951,6 +951,25 @@ Http2Stream::signal_read_event(int event)
   terminate_if_possible();
 }
 
+/** Signal the event that ends the read side, or hold it until reenable() if 
the consumer has the read VIO disabled.
+
+  A consumer that throttles its producer disables the read VIO. The END_STREAM 
that arrives during that
+  window is the only end-of-read signal the stream will see, so it must not be 
dropped.
+ */
+void
+Http2Stream::signal_final_read_event(int event)
+{
+  if (this->_is_read_gated()) {
+    return;
+  }
+  if (this->read_vio.is_disabled()) {
+    Http2StreamDebug("defer %s until the read VIO is re-enabled", 
get_vc_event_name(event));
+    this->_deferred_read_event = event;
+    return;
+  }
+  this->signal_read_event(event);

Review Comment:
   A final event can still be dropped on the mutex-retry path. If 
`signal_read_event()` cannot acquire the continuation mutex, it schedules 
`_read_vio_event`; that event is later retried through `signal_read_event()` 
(lines 185–187), not this final-event wrapper. If the tunnel disables the VIO 
while the mutex holder is processing the prior read callback, the retry returns 
because the VIO is disabled without setting `_deferred_read_event`. Preserve 
the event's final status until the callback is actually delivered—for example, 
route final-event retries back through this helper rather than the generic 
read-event path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to