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/09/01 07:49:12 UTC
[trafficserver] 03/05: Improve debug logs
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
commit d1cbe218accf9647e018c8a5a86ff3a93861c88e
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Aug 30 12:41:47 2017 +0900
Improve debug logs
---
iocore/net/QUICNetVConnection.cc | 2 +-
iocore/net/quic/QUICDebugNames.cc | 21 +++++++++++++++++++++
iocore/net/quic/QUICDebugNames.h | 2 ++
iocore/net/quic/QUICFrameDispatcher.cc | 3 ++-
iocore/net/quic/QUICStream.cc | 10 ++++++----
5 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 5d85ac3..0effe5f 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -296,6 +296,7 @@ QUICNetVConnection::state_pre_handshake(int event, Event *data)
this->set_inactivity_timeout(HRTIME_SECONDS(params->no_activity_timeout_in()));
this->add_to_active_queue();
+ DebugQUICCon("Enter state_handshake");
SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_handshake);
return this->handleEvent(event, data);
}
@@ -669,7 +670,6 @@ std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>
QUICNetVConnection::_build_packet(ats_unique_buf buf, size_t len, bool retransmittable, QUICPacketType type)
{
std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet(nullptr, &QUICPacketDeleter::delete_null_packet);
- DebugQUICCon("retransmittable %u", retransmittable);
switch (type) {
case QUICPacketType::SERVER_CLEARTEXT:
diff --git a/iocore/net/quic/QUICDebugNames.cc b/iocore/net/quic/QUICDebugNames.cc
index dae5885..66b6866 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -177,3 +177,24 @@ QUICDebugNames::transport_parameter_id(QUICTransportParameterId id)
return "UNKNOWN";
}
}
+
+const char *
+QUICDebugNames::stream_state(QUICStreamState state)
+{
+ switch (state.get()) {
+ case QUICStreamState::State::idle:
+ return "IDLE";
+ case QUICStreamState::State::open:
+ return "OPEN";
+ case QUICStreamState::State::half_closed_remote:
+ return "HC_REMOTE";
+ case QUICStreamState::State::half_closed_local:
+ return "HC_LOCAL";
+ case QUICStreamState::State::closed:
+ return "CLOSED";
+ case QUICStreamState::State::illegal:
+ return "ILLEGAL";
+ default:
+ return "UNKNOWN";
+ }
+}
diff --git a/iocore/net/quic/QUICDebugNames.h b/iocore/net/quic/QUICDebugNames.h
index 20fcc71..79702c6 100644
--- a/iocore/net/quic/QUICDebugNames.h
+++ b/iocore/net/quic/QUICDebugNames.h
@@ -25,6 +25,7 @@
#include "QUICTypes.h"
#include "QUICTransportParameters.h"
+#include "QUICStreamState.h"
class QUICDebugNames
{
@@ -34,6 +35,7 @@ public:
static const char *error_class(QUICErrorClass cls);
static const char *error_code(QUICErrorCode code);
static const char *transport_parameter_id(QUICTransportParameterId id);
+ static const char *stream_state(QUICStreamState state);
// TODO: move to somewhere
static const char *vc_event(int event);
diff --git a/iocore/net/quic/QUICFrameDispatcher.cc b/iocore/net/quic/QUICFrameDispatcher.cc
index eff5890..5b87cd1 100644
--- a/iocore/net/quic/QUICFrameDispatcher.cc
+++ b/iocore/net/quic/QUICFrameDispatcher.cc
@@ -27,6 +27,7 @@
#include "QUICCongestionController.h"
#include "QUICLossDetector.h"
#include "QUICEvents.h"
+#include "QUICDebugNames.h"
static constexpr char tag[] = "quic_frame_handler";
@@ -62,7 +63,7 @@ QUICFrameDispatcher::receive_frames(const uint8_t *payload, uint16_t size, bool
// TODO: check debug build
if (type != QUICFrameType::PADDING) {
- Debug(tag, "frame type %d, size %zu", static_cast<int>(frame->type()), frame->size());
+ Debug(tag, "Received %s frame, size %zu", QUICDebugNames::frame_type(frame->type()), frame->size());
}
should_send_ack |= (type != QUICFrameType::PADDING && type != QUICFrameType::ACK);
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 79fd4e8..42db203 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -28,7 +28,8 @@
#include "QUICDebugNames.h"
#include "QUICConfig.h"
-static constexpr char tag[] = "quic_stream";
+#define DebugQUICStream(fmt, ...) \
+ Debug("quic_stream", "[%" PRIx64 "] [%s] " fmt, static_cast<uint64_t>(this->_id), QUICDebugNames::stream_state(this->_state), ##__VA_ARGS__)
static constexpr uint64_t MAX_DATA_HEADSPACE = 10240; // in uints of octets
static constexpr uint64_t MAX_STREAM_DATA_HEADSPACE = 1024;
@@ -43,6 +44,7 @@ QUICStream::init(QUICStreamManager *manager, QUICFrameTransmitter *tx, QUICStrea
init_flow_control_params(recv_max_stream_data, send_max_stream_data);
this->mutex = new_ProxyMutex();
+ DebugQUICStream("Initialized");
}
void
@@ -68,7 +70,7 @@ QUICStream::id()
int
QUICStream::main_event_handler(int event, void *data)
{
- Debug(tag, "%s", QUICDebugNames::vc_event(event));
+ DebugQUICStream("%s", QUICDebugNames::vc_event(event));
switch (event) {
case VC_EVENT_READ_READY:
@@ -94,7 +96,7 @@ QUICStream::main_event_handler(int event, void *data)
break;
}
default:
- Debug(tag, "unknown event");
+ DebugQUICStream("unknown event");
ink_assert(false);
}
@@ -396,7 +398,7 @@ QUICStream::_send()
total_len += len;
if (!this->_state.is_allowed_to_send(*frame)) {
- Debug(tag, "Canceled sending %s frame due to the stream state", QUICDebugNames::frame_type(frame->type()));
+ DebugQUICStream("Canceled sending %s frame due to the stream state", QUICDebugNames::frame_type(frame->type()));
break;
}
this->_state.update_with_sent_frame(*frame);
--
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.