You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ez...@apache.org on 2019/05/16 17:30:27 UTC
[trafficserver] 01/02: Add ProxyError structure
This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 43429b74b4233fef6b3270bf5a500ae854cdc656
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue May 14 09:14:09 2019 +0900
Add ProxyError structure
The structure was originally added as a part of #3545, and this commit brings
only the data structure and minimul changes needed from the original commit.
---
proxy/ProxyClientSession.h | 15 +++++++++++++++
proxy/http2/Http2ConnectionState.cc | 3 +++
proxy/http2/Http2ConnectionState.h | 2 ++
3 files changed, 20 insertions(+)
diff --git a/proxy/ProxyClientSession.h b/proxy/ProxyClientSession.h
index 85f62a0..22190e6 100644
--- a/proxy/ProxyClientSession.h
+++ b/proxy/ProxyClientSession.h
@@ -37,6 +37,21 @@
class ProxyClientTransaction;
struct AclRecord;
+enum class ProxyErrorClass {
+ NONE,
+ SSN,
+ TXN,
+};
+
+struct ProxyError {
+ ProxyError() {}
+ ProxyError(ProxyErrorClass cl, uint32_t co) : cls(cl), code(co) {}
+ size_t str(char *buf, size_t buf_len);
+
+ ProxyErrorClass cls = ProxyErrorClass::NONE;
+ uint32_t code = 0;
+};
+
class ProxyClientSession : public VConnection
{
public:
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index a62d386..7f81cf4 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -636,6 +636,7 @@ rcv_goaway_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
Http2StreamDebug(cstate.ua_session, stream_id, "GOAWAY: last stream id=%d, error code=%d", goaway.last_streamid,
static_cast<int>(goaway.error_code));
+ cstate.rx_error_code = {ProxyErrorClass::SSN, static_cast<uint32_t>(goaway.error_code)};
cstate.handleEvent(HTTP2_SESSION_EVENT_FINI, nullptr);
// eventProcessor.schedule_imm(&cs, ET_NET, VC_EVENT_ERROR);
@@ -1724,6 +1725,8 @@ Http2ConnectionState::send_goaway_frame(Http2StreamId id, Http2ErrorCode ec)
http2_write_goaway(goaway, frame.write());
frame.finalize(HTTP2_GOAWAY_LEN);
+ this->tx_error_code = {ProxyErrorClass::SSN, static_cast<uint32_t>(ec)};
+
// xmit event
SCOPED_MUTEX_LOCK(lock, this->ua_session->mutex, this_ethread());
this->ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &frame);
diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h
index f3b4cc3..e773f32 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -132,6 +132,8 @@ public:
SET_HANDLER(&Http2ConnectionState::main_event_handler);
}
+ ProxyError rx_error_code;
+ ProxyError tx_error_code;
Http2ClientSession *ua_session;
HpackHandle *local_hpack_handle;
HpackHandle *remote_hpack_handle;