trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From masa...@apache.org
Subject [trafficserver] 03/03: Remove unnecessary checks before generate_frame() calls
Date Fri, 03 Aug 2018 07:24:37 GMT
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit c0f4400280d8ac033c497ab1f598a7526f1aefec
Author: Masaori Koshiba <masaori@apache.org>
AuthorDate: Fri Aug 3 16:23:48 2018 +0900

    Remove unnecessary checks before generate_frame() calls
---
 iocore/net/QUICNetVConnection.cc | 73 +++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 93e8143..f9f48f1 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1305,35 +1305,36 @@ QUICNetVConnection::_packetize_frames(QUICEncryptionLevel level, uint64_t
max_pa
   }
 
   // CRYPTO
-  if (this->_handshake_handler->will_generate_frame(level)) {
+  frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
+  while (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
     frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
-    while (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-      frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
-    }
   }
 
   // ACK
-  if (this->_ack_frame_creator.will_generate_frame(level)) {
-    frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
-    if (frame != nullptr) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
+  if (will_be_ack_only) {
+    if (this->_ack_frame_creator.will_generate_frame(level)) {
+      frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
     }
+  } else {
+    frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
+  }
+
+  if (frame != nullptr) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
   }
 
   // PATH_CHALLENGE, PATH_RESPOSNE
-  if (this->_path_validator->will_generate_frame(level)) {
-    frame = this->_path_validator->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
-    if (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-    }
+  frame = this->_path_validator->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
+  if (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
   }
 
   // NEW_CONNECTION_ID
-  if (this->_alt_con_manager && this->_alt_con_manager->will_generate_frame(level))
{
+  if (this->_alt_con_manager) {
     frame = this->_alt_con_manager->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
     while (frame) {
       ++frame_count;
@@ -1344,31 +1345,27 @@ QUICNetVConnection::_packetize_frames(QUICEncryptionLevel level, uint64_t
max_pa
   }
 
   // Lost frames
-  if (this->_packet_retransmitter.will_generate_frame(level)) {
-    frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
-    while (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
+  frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
+  while (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
 
-      frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
-    }
+    frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
   }
 
   // STREAM, MAX_STREAM_DATA, STREAM_BLOCKED
-  if (this->_stream_manager->will_generate_frame(level)) {
-    frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
-    while (frame) {
-      ++frame_count;
-      if (frame->type() == QUICFrameType::STREAM) {
-        int ret = this->_remote_flow_controller->update(this->_stream_manager->total_offset_sent());
-        QUICFCDebug("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
-                    this->_remote_flow_controller->current_limit());
-        ink_assert(ret == 0);
-      }
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-
-      frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
+  frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
+  while (frame) {
+    ++frame_count;
+    if (frame->type() == QUICFrameType::STREAM) {
+      int ret = this->_remote_flow_controller->update(this->_stream_manager->total_offset_sent());
+      QUICFCDebug("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
+                  this->_remote_flow_controller->current_limit());
+      ink_assert(ret == 0);
     }
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
+
+    frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(),
max_frame_size);
   }
 
   // Schedule a packet


Mime
View raw message