You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/11/30 08:55:47 UTC

[trafficserver] branch quic-latest updated: Fix connection level flow control calculation

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 86a0e52  Fix connection level flow control calculation
86a0e52 is described below

commit 86a0e52f73737e08d8f70ef22380561a91e7b047
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Thu Nov 30 17:55:02 2017 +0900

    Fix connection level flow control calculation
---
 iocore/net/P_QUICNetVConnection.h     |  1 -
 iocore/net/QUICNetVConnection.cc      | 32 +++++++++++---------------------
 iocore/net/quic/QUICFlowController.cc |  2 +-
 iocore/net/quic/QUICStreamManager.cc  |  2 +-
 4 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index b504fea..da7a132 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -232,7 +232,6 @@ private:
   void _transmit_packet(QUICPacketUPtr);
   void _transmit_frame(QUICFrameUPtr);
 
-  bool _is_send_frame_avail_more_than(uint32_t size);
   void _store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType &current_packet_type,
                     QUICFrameUPtr frame);
   void _packetize_frames();
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 4b113d7..2e122d9 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -325,7 +325,7 @@ QUICNetVConnection::handle_frame(std::shared_ptr<const QUICFrame> frame)
 
   switch (frame->type()) {
   case QUICFrameType::MAX_DATA:
-    this->_remote_flow_controller->forward_limit(std::static_pointer_cast<const QUICMaxDataFrame>(frame)->maximum_data());
+    this->_remote_flow_controller->forward_limit(std::static_pointer_cast<const QUICMaxDataFrame>(frame)->maximum_data() * 1024);
     Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [REMOTE] %" PRIu64 "/%" PRIu64,
           static_cast<uint64_t>(this->_quic_connection_id), this->_remote_flow_controller->current_offset(),
           this->_remote_flow_controller->current_limit());
@@ -738,23 +738,6 @@ QUICNetVConnection::_state_common_send_packet()
   return QUICErrorUPtr(new QUICNoError());
 }
 
-// Schedule sending BLOCKED frame when offset exceed the limit
-bool
-QUICNetVConnection::_is_send_frame_avail_more_than(uint32_t size)
-{
-  QUICErrorUPtr error = this->_remote_flow_controller->update((this->_stream_manager->total_offset_sent() + size) / 1024);
-  Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [REMOTE] %" PRIu64 "/%" PRIu64,
-        static_cast<uint64_t>(this->_quic_connection_id), this->_remote_flow_controller->current_offset(),
-        this->_remote_flow_controller->current_limit());
-
-  if (error->cls != QUICErrorClass::NONE) {
-    // Flow Contoroller blocked sending STREAM frame
-    return false;
-  }
-
-  return true;
-}
-
 // Store frame data to buffer for packet. When remaining buffer is too small to store frame data or packet type is different from
 // previous one, build packet and transmit it. After that, allocate new buffer.
 void
@@ -816,7 +799,14 @@ QUICNetVConnection::_packetize_frames()
   while (this->_stream_frame_send_queue.size() > 0) {
     const QUICFrameUPtr &f = this->_stream_frame_send_queue.front();
     uint32_t frame_size    = f->size();
-    if (!this->_is_send_frame_avail_more_than(frame_size)) {
+
+    QUICErrorUPtr error = this->_remote_flow_controller->update((this->_stream_manager->total_offset_sent() + frame_size));
+    Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [REMOTE] %" PRIu64 "/%" PRIu64,
+          static_cast<uint64_t>(this->_quic_connection_id), this->_remote_flow_controller->current_offset(),
+          this->_remote_flow_controller->current_limit());
+
+    if (error->cls != QUICErrorClass::NONE) {
+      // Flow Contoroller blocked sending STREAM frame
       break;
     }
 
@@ -910,8 +900,8 @@ QUICNetVConnection::_init_flow_control_params(const std::shared_ptr<const QUICTr
     remote_initial_max_data = remote_tp->initial_max_data();
   }
 
-  this->_local_flow_controller->forward_limit(local_initial_max_data);
-  this->_remote_flow_controller->forward_limit(remote_initial_max_data);
+  this->_local_flow_controller->forward_limit(local_initial_max_data * 1024);
+  this->_remote_flow_controller->forward_limit(remote_initial_max_data * 1024);
   Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [LOCAL] %" PRIu64 "/%" PRIu64, static_cast<uint64_t>(this->_quic_connection_id),
         this->_local_flow_controller->current_offset(), this->_local_flow_controller->current_limit());
   Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [REMOTE] %" PRIu64 "/%" PRIu64,
diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index 6c497aa..68e01c5 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -126,7 +126,7 @@ QUICRemoteConnectionFlowController::_create_frame()
 QUICFrameUPtr
 QUICLocalConnectionFlowController::_create_frame()
 {
-  return QUICFrameFactory::create_max_data_frame(this->_limit);
+  return QUICFrameFactory::create_max_data_frame(this->_limit / 1024);
 }
 
 QUICFrameUPtr
diff --git a/iocore/net/quic/QUICStreamManager.cc b/iocore/net/quic/QUICStreamManager.cc
index 64190e5..b5c10eb 100644
--- a/iocore/net/quic/QUICStreamManager.cc
+++ b/iocore/net/quic/QUICStreamManager.cc
@@ -233,7 +233,7 @@ QUICStreamManager::total_offset_received() const
   // FIXME Iterating all (open + closed) streams is expensive
   for (QUICStream *s = this->stream_list.head; s; s = s->link.next) {
     if (s->id() != 0) {
-      total_offset_received += s->largest_offset_received() / 1024;
+      total_offset_received += s->largest_offset_received();
     }
   }
   return total_offset_received;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].