This is an automated email from the ASF dual-hosted git repository. maskit pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push: new c193d32 Prevent triggering READ_READY event on every frame c193d32 is described below commit c193d323b0dc8e883a0f5d182319bf5e831b7f3c Author: Masakazu Kitajo <mas...@apache.org> AuthorDate: Wed Sep 6 10:46:40 2017 +0900 Prevent triggering READ_READY event on every frame --- iocore/net/QUICNetVConnection.cc | 6 +++--- iocore/net/quic/QUICApplication.cc | 4 +++- iocore/net/quic/QUICStream.cc | 6 +++--- iocore/net/quic/QUICStream.h | 2 +- iocore/net/quic/QUICStreamManager.cc | 11 ++++++----- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 083dfa0..d6b233c 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -353,7 +353,7 @@ QUICNetVConnection::state_handshake(int event, Event *data) break; } case QUIC_EVENT_PACKET_WRITE_READY: { - error = this->_state_common_send_packet(); + error = this->_state_common_send_packet(); this->_packet_write_ready = nullptr; break; } @@ -398,7 +398,7 @@ QUICNetVConnection::state_connection_established(int event, Event *data) break; } case QUIC_EVENT_PACKET_WRITE_READY: { - error = this->_state_common_send_packet(); + error = this->_state_common_send_packet(); this->_packet_write_ready = nullptr; break; } @@ -459,7 +459,7 @@ QUICNetVConnection::state_connection_closed(int event, Event *data) break; } case QUIC_EVENT_PACKET_WRITE_READY: { - this->_packet_write_ready = nullptr; + this->_packet_write_ready = nullptr; this->next_inactivity_timeout_at = 0; this->next_activity_timeout_at = 0; diff --git a/iocore/net/quic/QUICApplication.cc b/iocore/net/quic/QUICApplication.cc index 455459a..b65b89c 100644 --- a/iocore/net/quic/QUICApplication.cc +++ b/iocore/net/quic/QUICApplication.cc @@ -52,7 +52,9 @@ QUICStreamIO::read_avail() int64_t QUICStreamIO::read(uint8_t *buf, int64_t len) { - return this->_read_buffer_reader->read(const_cast<uint8_t *>(buf), len); + int64_t read_len = this->_read_buffer_reader->read(const_cast<uint8_t *>(buf), len); + this->_read_vio->ndone += read_len; + return read_len; } int64_t diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc index f03dd8a..c16d0dd 100644 --- a/iocore/net/quic/QUICStream.cc +++ b/iocore/net/quic/QUICStream.cc @@ -392,10 +392,10 @@ QUICStream::reset() // TODO: Create a RST_STREAM frame and pass it to Stream Manager } -bool -QUICStream::is_read_ready() +size_t +QUICStream::nbytes_to_read() { - return this->_read_vio.nbytes > 0; + return this->_read_vio.ntodo(); } QUICOffset diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h index 2f28c90..0c3e73b 100644 --- a/iocore/net/quic/QUICStream.h +++ b/iocore/net/quic/QUICStream.h @@ -66,7 +66,7 @@ public: void reset(); - bool is_read_ready(); + size_t nbytes_to_read(); QUICOffset largest_offset_received(); QUICOffset largest_offset_sent(); diff --git a/iocore/net/quic/QUICStreamManager.cc b/iocore/net/quic/QUICStreamManager.cc index 8db20ca..6125cf9 100644 --- a/iocore/net/quic/QUICStreamManager.cc +++ b/iocore/net/quic/QUICStreamManager.cc @@ -132,11 +132,12 @@ QUICStreamManager::_handle_frame(const std::shared_ptr<const QUICStreamFrame> &f application->set_stream(stream); } - QUICError error = stream->recv(frame); - - // FIXME: schedule VC_EVENT_READ_READY to application every single frame? - // If application reading buffer continuously, do not schedule event. - this_ethread()->schedule_imm(application, VC_EVENT_READ_READY, stream); + size_t nbytes_to_read = stream->nbytes_to_read(); + QUICError error = stream->recv(frame); + // Prevent trigger read events multiple times + if (nbytes_to_read == 0) { + this_ethread()->schedule_imm(application, VC_EVENT_READ_READY, stream); + } return error; } -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].