trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [trafficserver] 01/06: TS-4841: Log field cqtr is inaccurate for HTTP/2
Date Tue, 27 Sep 2016 17:30:27 GMT
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 7.0.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit ff3d0ec2195472f09c43e8d2e4fe7d4d8d60f784
Author: Susan Hinrichs <shinrich@ieee.org>
AuthorDate: Mon Sep 26 15:51:53 2016 +0000

    TS-4841:  Log field cqtr is inaccurate for HTTP/2
    
    (cherry picked from commit d64461df3e6ea72f22b3bd7f0ced7d2968626170)
---
 proxy/ProxyClientTransaction.h      |  6 ++++++
 proxy/http/HttpSM.cc                |  2 +-
 proxy/http2/Http2ClientSession.h    |  2 +-
 proxy/http2/Http2ConnectionState.cc |  4 +++-
 proxy/http2/Http2ConnectionState.h  | 14 ++++++++++++++
 proxy/http2/Http2Stream.h           |  8 ++++++++
 6 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/proxy/ProxyClientTransaction.h b/proxy/ProxyClientTransaction.h
index 0238707..64ff641 100644
--- a/proxy/ProxyClientTransaction.h
+++ b/proxy/ProxyClientTransaction.h
@@ -59,6 +59,12 @@ public:
     return parent ? parent->get_transact_count() : 0;
   }
 
+  virtual bool
+  is_first_transaction() const
+  {
+    return get_transact_count() == 1;
+  }
+
   // Ask your session if this is allowed
   bool
   is_transparent_passthrough_allowed()
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index b72e47b..a271e13 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -526,7 +526,7 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader
   ua_session = client_vc;
 
   // Collect log & stats information
-  client_tcp_reused         = (1 < ua_session->get_transact_count());
+  client_tcp_reused         = !(ua_session->is_first_transaction());
   SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(netvc);
   if (ssl_vc != NULL) {
     client_connection_is_ssl = true;
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index dbece26..c4d873b 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -212,7 +212,7 @@ public:
   virtual int
   get_transact_count() const
   {
-    return (int)con_id;
+    return connection_state.get_stream_requests();
   }
   virtual void
   release(ProxyClientTransaction *trans)
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index e1fa654..afffb50 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -922,7 +922,9 @@ Http2ConnectionState::create_stream(Http2StreamId new_id)
   ++total_client_streams_count;
 
   new_stream->set_parent(ua_session);
-  new_stream->mutex = ua_session->mutex;
+  new_stream->mutex                     = ua_session->mutex;
+  new_stream->is_first_transaction_flag = get_stream_requests() == 0;
+  increment_stream_requests();
   ua_session->get_netvc()->add_to_active_queue();
   // reset the activity timeout everytime a new stream is created
   ua_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(Http2::active_timeout_in));
diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h
index 2ef3453..eb6f930 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -119,6 +119,7 @@ public:
       stream_list(),
       latest_streamid_in(0),
       latest_streamid_out(0),
+      stream_requests(0),
       client_streams_in_count(0),
       client_streams_out_count(0),
       total_client_streams_count(0),
@@ -191,6 +192,18 @@ public:
     return latest_streamid_out;
   }
 
+  int
+  get_stream_requests() const
+  {
+    return stream_requests;
+  }
+
+  void
+  increment_stream_requests()
+  {
+    stream_requests++;
+  }
+
   // Continuated header decoding
   Http2StreamId
   get_continued_stream_id() const
@@ -267,6 +280,7 @@ private:
   DLL<Http2Stream> stream_list;
   Http2StreamId latest_streamid_in;
   Http2StreamId latest_streamid_out;
+  int stream_requests;
 
   // Counter for current active streams which is started by client
   uint32_t client_streams_in_count;
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index 6aa2dec..924275e 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -50,6 +50,7 @@ public:
       sent_request_header(false),
       response_header_done(false),
       request_sent(false),
+      is_first_transaction_flag(false),
       response_reader(NULL),
       request_reader(NULL),
       request_buffer(CLIENT_CONNECTION_FIRST_READ_BUFFER_SIZE_INDEX),
@@ -204,6 +205,7 @@ public:
   bool sent_request_header;
   bool response_header_done;
   bool request_sent;
+  bool is_first_transaction_flag;
 
   HTTPHdr response_header;
   IOBufferReader *response_reader;
@@ -252,6 +254,12 @@ public:
     return closed;
   }
 
+  bool
+  is_first_transaction() const
+  {
+    return is_first_transaction_flag;
+  }
+
 private:
   void response_initialize_data_handling(bool &is_done);
   void response_process_data(bool &is_done);

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

Mime
View raw message