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 2018/04/20 06:29:33 UTC

[trafficserver] branch quic-latest updated: Print appropriate frame info in debug log

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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 5beddd6  Print appropriate frame info in debug log
5beddd6 is described below

commit 5beddd6d1e29ceaff9c488f00949dab17f28ab48
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Apr 20 15:29:17 2018 +0900

    Print appropriate frame info in debug log
---
 iocore/net/QUICNetVConnection.cc       |  9 ++++++---
 iocore/net/quic/QUICFrame.cc           | 28 ++++++++++++++++++++++++++++
 iocore/net/quic/QUICFrame.h            |  4 ++++
 iocore/net/quic/QUICFrameDispatcher.cc |  4 +++-
 iocore/net/quic/QUICLossDetector.cc    |  7 -------
 5 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 506223d..b7a3832 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1092,8 +1092,6 @@ void
 QUICNetVConnection::_store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType &current_packet_type,
                                  QUICFrameUPtr frame)
 {
-  QUICConVDebug("type=%s size=%zu", QUICDebugNames::frame_type(frame->type()), frame->size());
-
   uint32_t max_size = this->maximum_quic_packet_size();
 
   QUICPacketType previous_packet_type = current_packet_type;
@@ -1120,7 +1118,12 @@ QUICNetVConnection::_store_frame(ats_unique_buf &buf, size_t &len, bool &retrans
   }
 
   size_t l = 0;
-  QUICConDebug("type=%s size=%zu", QUICDebugNames::frame_type(frame->type()), frame->size());
+
+  // TODO: check debug build
+  char msg[1024];
+  frame->debug_msg(msg, sizeof(msg));
+  QUICConDebug("[TX] %s", msg);
+
   frame->store(buf.get() + len, &l);
   len += l;
 
diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index a2fadd9..428f1e2 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -24,6 +24,7 @@
 #include "QUICFrame.h"
 #include "QUICStream.h"
 #include "QUICIntUtil.h"
+#include "QUICDebugNames.h"
 
 ClassAllocator<QUICStreamFrame> quicStreamFrameAllocator("quicStreamFrameAllocator");
 ClassAllocator<QUICAckFrame> quicAckFrameAllocator("quicAckFrameAllocator");
@@ -75,6 +76,12 @@ QUICFrame::is_protected() const
   return this->_protection;
 }
 
+int
+QUICFrame::debug_msg(char *msg, size_t msg_len) const
+{
+  return snprintf(msg, msg_len, "type=%s size=%zu", QUICDebugNames::frame_type(this->type()), this->size());
+}
+
 //
 // STREAM Frame
 //
@@ -108,6 +115,13 @@ QUICStreamFrame::store(uint8_t *buf, size_t *len) const
   this->store(buf, len, true);
 }
 
+int
+QUICStreamFrame::debug_msg(char *msg, size_t msg_len) const
+{
+  return snprintf(msg, msg_len, "type=STREAM size=%zu id=%" PRIu64 " offset=%" PRIu64 " data_len=%" PRIu64 " fin=%d", this->size(),
+                  this->stream_id(), this->offset(), this->data_length(), this->has_fin_flag());
+}
+
 void
 QUICStreamFrame::store(uint8_t *buf, size_t *len, bool include_length_field) const
 {
@@ -381,6 +395,20 @@ QUICAckFrame::store(uint8_t *buf, size_t *len) const
   return;
 }
 
+int
+QUICAckFrame::debug_msg(char *msg, size_t msg_len) const
+{
+  int len = snprintf(msg, msg_len, "type=ACK size=%zu largest_acked=%" PRIu64 " delay=%" PRIu64 " block_count=%" PRIu64,
+                     this->size(), this->largest_acknowledged(), this->ack_delay(), this->ack_block_count());
+  msg_len -= len;
+
+  if (this->ack_block_section()) {
+    len += snprintf(msg + len, msg_len, " first_ack_block=%" PRIu64, this->ack_block_section()->first_ack_block());
+  }
+
+  return len;
+}
+
 bool
 QUICAckFrame::is_protected() const
 {
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index f871541..89a289b 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -45,6 +45,7 @@ public:
   virtual void store(uint8_t *buf, size_t *len) const = 0;
   virtual void reset(const uint8_t *buf, size_t len);
   virtual bool is_protected() const;
+  virtual int debug_msg(char *msg, size_t msg_len) const;
   LINK(QUICFrame, link);
 
 protected:
@@ -69,6 +70,7 @@ public:
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
+  virtual int debug_msg(char *msg, size_t msg_len) const override;
 
   void store(uint8_t *buf, size_t *len, bool include_length_field) const;
   QUICStreamId stream_id() const;
@@ -198,6 +200,8 @@ public:
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
+  virtual int debug_msg(char *msg, size_t msg_len) const override;
+
   bool is_protected() const override;
 
   QUICPacketNumber largest_acknowledged() const;
diff --git a/iocore/net/quic/QUICFrameDispatcher.cc b/iocore/net/quic/QUICFrameDispatcher.cc
index 5b8b7a1..a6e5876 100644
--- a/iocore/net/quic/QUICFrameDispatcher.cc
+++ b/iocore/net/quic/QUICFrameDispatcher.cc
@@ -58,7 +58,9 @@ QUICFrameDispatcher::receive_frames(const uint8_t *payload, uint16_t size, bool
 
     // TODO: check debug build
     if (type != QUICFrameType::PADDING) {
-      Debug(tag, "type=%s, size=%zu", QUICDebugNames::frame_type(frame->type()), frame->size());
+      char msg[1024];
+      frame->debug_msg(msg, sizeof(msg));
+      Debug(tag, "[RX] %s", msg);
     }
 
     should_send_ack |= (type != QUICFrameType::PADDING && type != QUICFrameType::ACK);
diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc
index 0c873c0..d0ace9c 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -192,13 +192,6 @@ QUICLossDetector::_on_ack_received(const std::shared_ptr<const QUICAckFrame> &ac
   SCOPED_MUTEX_LOCK(transmitter_lock, this->_transmitter->get_packet_transmitter_mutex().get(), this_ethread());
   SCOPED_MUTEX_LOCK(lock, this->_loss_detection_mutex, this_ethread());
 
-  QUICLDDebug("Largest Acknowledged: %" PRIu64, ack_frame->largest_acknowledged());
-  QUICLDDebug("ACK Delay: %" PRIu64, ack_frame->ack_delay());
-  QUICLDDebug("ACK Block Count: %" PRIu64, ack_frame->ack_block_count());
-  if (ack_frame->ack_block_section()) {
-    QUICLDDebug("First ACK Block: %" PRIu64, ack_frame->ack_block_section()->first_ack_block());
-  }
-
   this->_largest_acked_packet = ack_frame->largest_acknowledged();
   // If the largest acked is newly acked, update the RTT.
   auto pi = this->_sent_packets.find(ack_frame->largest_acknowledged());

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.