masaori335 commented on a change in pull request #5972:
URL: https://github.com/apache/trafficserver/pull/5972#discussion_r425586675



##########
File path: proxy/http2/Http2Stream.cc
##########
@@ -523,44 +530,26 @@ Http2Stream::update_read_request(int64_t read_len, bool 
call_update, bool check_
   ink_release_assert(this->_thread == this_ethread());
 
   SCOPED_MUTEX_LOCK(lock, read_vio.mutex, this_ethread());
-  if (read_vio.nbytes > 0 && read_vio.ndone <= read_vio.nbytes) {
-    // If this vio has a different buffer, we must copy
-    ink_release_assert(this_ethread() == this->_thread);
-    if (read_vio.buffer.writer() != (&request_buffer)) {
-      int64_t num_to_read = read_vio.nbytes - read_vio.ndone;
-      if (num_to_read > read_len) {
-        num_to_read = read_len;
-      }
-      if (num_to_read > 0) {
-        int bytes_added = read_vio.buffer.writer()->write(request_reader, 
num_to_read);
-        if (bytes_added > 0 || (check_eos && recv_end_stream)) {
-          request_reader->consume(bytes_added);
-          read_vio.ndone += bytes_added;
-          int send_event = (read_vio.nbytes == read_vio.ndone || 
recv_end_stream) ? VC_EVENT_READ_COMPLETE : VC_EVENT_READ_READY;
-          if (call_update) { // Safe to call vio handler directly
-            inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
-            if (read_vio.cont && this->_sm) {
-              read_vio.cont->handleEvent(send_event, &read_vio);
-            }
-          } else { // Called from do_io_read.  Still setting things up.  Send 
event to handle this after the dust settles
-            read_event = send_tracked_event(read_event, send_event, &read_vio);
-          }
-        }
-      }
-    } else {
-      // Try to be smart and only signal if there was additional data
-      int send_event = (read_vio.nbytes == read_vio.ndone) ? 
VC_EVENT_READ_COMPLETE : VC_EVENT_READ_READY;
-      if (request_reader->read_avail() > 0 || send_event == 
VC_EVENT_READ_COMPLETE) {
-        if (call_update) { // Safe to call vio handler directly
-          inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
-          if (read_vio.cont && this->_sm) {
-            read_vio.cont->handleEvent(send_event, &read_vio);
-          }
-        } else { // Called from do_io_read.  Still setting things up.  Send 
event
-                 // to handle this after the dust settles
-          read_event = send_tracked_event(read_event, send_event, &read_vio);
-        }
+  if (read_vio.nbytes == 0) {
+    return;
+  }
+
+  // Try to be smart and only signal if there was additional data
+  int send_event = VC_EVENT_READ_READY;
+  if (read_vio.ntodo() == 0 || (this->recv_end_stream && this->read_vio.nbytes 
!= INT64_MAX)) {

Review comment:
       IIRC, this is for some AuTest failures. This checks the upper layer 
(HttpSM/HttpTunnel) called `do_io_read(this, INT64_MAX, XXXX)`. Yes, it's a bit 
unreliable. ( I should have left some comments )
   




----------------------------------------------------------------
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.

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


Reply via email to