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 368e54b Schedule QUIC_EVENT_PACKET_WRITE_READY only if it's not scheduled 368e54b is described below commit 368e54b8df5acd4c5eff21a7d29a7fec643bc04f Author: Masakazu Kitajo <mas...@apache.org> AuthorDate: Tue Sep 5 16:24:08 2017 +0900 Schedule QUIC_EVENT_PACKET_WRITE_READY only if it's not scheduled --- iocore/net/P_QUICNetVConnection.h | 2 ++ iocore/net/QUICNetVConnection.cc | 13 ++++++++++--- iocore/net/quic/QUICFrameTransmitter.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index 02606ea..3937017 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -220,6 +220,8 @@ private: Queue<QUICPacket> _packet_send_queue; std::queue<std::unique_ptr<QUICFrame, QUICFrameDeleterFunc>> _frame_buffer; + Event *_packet_write_ready = nullptr; + void _packetize_frames(); std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> _build_packet(ats_unique_buf buf, size_t len, bool retransmittable, QUICPacketType type = QUICPacketType::UNINITIALIZED); diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 8cf5763..083dfa0 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -195,7 +195,9 @@ QUICNetVConnection::transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDelete { // TODO Remove const_cast this->_packet_send_queue.enqueue(const_cast<QUICPacket *>(packet.release())); - eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, nullptr); + if (!this->_packet_write_ready) { + this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, nullptr); + } } void @@ -242,7 +244,9 @@ QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFu { DebugQUICCon("Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), frame->size()); this->_frame_buffer.push(std::move(frame)); - eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, nullptr); + if (!this->_packet_write_ready) { + this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, nullptr); + } } void @@ -350,6 +354,7 @@ QUICNetVConnection::state_handshake(int event, Event *data) } case QUIC_EVENT_PACKET_WRITE_READY: { error = this->_state_common_send_packet(); + this->_packet_write_ready = nullptr; break; } case EVENT_IMMEDIATE: { @@ -394,6 +399,7 @@ QUICNetVConnection::state_connection_established(int event, Event *data) } case QUIC_EVENT_PACKET_WRITE_READY: { error = this->_state_common_send_packet(); + this->_packet_write_ready = nullptr; break; } @@ -428,6 +434,7 @@ QUICNetVConnection::state_connection_closing(int event, Event *data) } case QUIC_EVENT_PACKET_WRITE_READY: { this->_state_common_send_packet(); + this->_packet_write_ready = nullptr; break; } default: @@ -452,6 +459,7 @@ QUICNetVConnection::state_connection_closed(int event, Event *data) break; } case QUIC_EVENT_PACKET_WRITE_READY: { + this->_packet_write_ready = nullptr; this->next_inactivity_timeout_at = 0; this->next_activity_timeout_at = 0; @@ -722,7 +730,6 @@ QUICNetVConnection::_recv_and_ack(const uint8_t *payload, uint16_t size, QUICPac std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> ack_frame = this->_ack_frame_creator.create_if_needed(); if (ack_frame != nullptr) { this->transmit_frame(std::move(ack_frame)); - eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, nullptr); } return error; diff --git a/iocore/net/quic/QUICFrameTransmitter.h b/iocore/net/quic/QUICFrameTransmitter.h index ce3c267..bbf478a 100644 --- a/iocore/net/quic/QUICFrameTransmitter.h +++ b/iocore/net/quic/QUICFrameTransmitter.h @@ -31,7 +31,7 @@ public: /* * Enqueue a frame for transmission * - * This sends QUIC_PACKET_WRITE_READY event. + * This schedules QUIC_PACKET_WRITE_READY event. */ virtual void transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame) = 0; virtual uint32_t maximum_stream_frame_data_size() = 0; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].