MCPcopy Create free account
hub / github.com/apache/trafficserver / update_read_request

Method update_read_request

src/proxy/http2/Http2Stream.cc:731–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731void
732Http2Stream::update_read_request(bool call_update)
733{
734 if (closed || _proxy_ssn == nullptr || _sm == nullptr || read_vio.mutex == nullptr) {
735 return;
736 }
737
738 if (!this->_switch_thread_if_not_on_right_thread(VC_EVENT_READ_READY, nullptr)) {
739 // Not on the right thread
740 return;
741 }
742 ink_release_assert(this->_thread == this_ethread());
743
744 SCOPED_MUTEX_LOCK(lock, read_vio.mutex, this_ethread());
745 if (read_vio.nbytes == 0 || read_vio.is_disabled()) {
746 return;
747 }
748
749 // Try to be smart and only signal if there was additional data
750 int send_event = VC_EVENT_READ_READY;
751 if (read_vio.ntodo() == 0 || (this->receive_end_stream && this->read_vio.nbytes != INT64_MAX)) {
752 send_event = VC_EVENT_READ_COMPLETE;
753 }
754
755 int64_t read_avail = this->read_vio.get_writer()->max_read_avail();
756 if (read_avail > 0 || send_event == VC_EVENT_READ_COMPLETE) {
757 if (call_update) { // Safe to call vio handler directly
758 _timeout.update_inactivity();
759 if (read_vio.cont && this->_sm) {
760 read_vio.cont->handleEvent(send_event, &read_vio);
761 }
762 } else { // Called from do_io_read. Still setting things up. Send event
763 // to handle this after the dust settles
764 read_event = send_tracked_event(read_event, send_event, &read_vio);
765 }
766 }
767}
768
769void
770Http2Stream::restart_sending()

Callers 1

main_event_handlerMethod · 0.95

Calls 8

this_ethreadFunction · 0.85
is_disabledMethod · 0.80
ntodoMethod · 0.80
max_read_availMethod · 0.80
get_writerMethod · 0.80
update_inactivityMethod · 0.80
handleEventMethod · 0.45

Tested by

no test coverage detected