You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/08/18 21:11:16 UTC

trafficserver git commit: TS-3850: Add accept and no activity timeouts for HTTP/2

Repository: trafficserver
Updated Branches:
  refs/heads/master 7d15f72c0 -> ef0f0e1ae


TS-3850: Add accept and no activity timeouts for HTTP/2


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ef0f0e1a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ef0f0e1a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ef0f0e1a

Branch: refs/heads/master
Commit: ef0f0e1ae1b9574695050ec370c6f40ccba6c25c
Parents: 7d15f72
Author: Bryan Call <bc...@apache.org>
Authored: Tue Aug 18 12:08:07 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Tue Aug 18 12:11:09 2015 -0700

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc             | 4 ++++
 proxy/http2/HTTP2.cc              | 4 ++++
 proxy/http2/HTTP2.h               | 2 ++
 proxy/http2/Http2ClientSession.cc | 3 ++-
 4 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ef0f0e1a/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 3d2d2b0..2db3c66 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1960,6 +1960,10 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.max_header_list_size", RECD_INT, "4294967295", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http2.accept_no_activity_timeout", RECD_INT, "120", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.http2.no_activity_timeout_in", RECD_INT, "115", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
 
   //# Add LOCAL Records Here
   {RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, NULL, RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ef0f0e1a/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 39a68cf..b635f48 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -741,6 +741,8 @@ uint32_t Http2::max_frame_size = 16384;
 uint32_t Http2::header_table_size = 4096;
 uint32_t Http2::max_header_list_size = 4294967295;
 uint32_t Http2::max_request_header_size = 131072;
+uint32_t Http2::accept_no_activity_timeout = 120;
+uint32_t Http2::no_activity_timeout_in = 115;
 
 void
 Http2::init()
@@ -751,6 +753,8 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(header_table_size, "proxy.config.http2.header_table_size");
   REC_EstablishStaticConfigInt32U(max_header_list_size, "proxy.config.http2.max_header_list_size");
   REC_EstablishStaticConfigInt32U(max_request_header_size, "proxy.config.http.request_header_max_size");
+  REC_EstablishStaticConfigInt32U(accept_no_activity_timeout, "proxy.config.http2.accept_no_activity_timeout");
+  REC_EstablishStaticConfigInt32U(no_activity_timeout_in, "proxy.config.http2.no_activity_timeout_in");
 
   // If any settings is broken, ATS should not start
   ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, max_concurrent_streams}) &&

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ef0f0e1a/proxy/http2/HTTP2.h
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 3506f69..3177fa3 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -346,6 +346,8 @@ public:
   static uint32_t header_table_size;
   static uint32_t max_header_list_size;
   static uint32_t max_request_header_size;
+  static uint32_t accept_no_activity_timeout;
+  static uint32_t no_activity_timeout_in;
 
   static void init();
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ef0f0e1a/proxy/http2/Http2ClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc
index ac990c2..7310662 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -117,6 +117,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
   // Unique client session identifier.
   this->con_id = ProxyClientSession::next_connection_id();
   this->client_vc = new_vc;
+  client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::accept_no_activity_timeout));
   this->mutex = new_vc->mutex;
 
   this->connection_state.mutex = new_ProxyMutex();
@@ -289,7 +290,7 @@ Http2ClientSession::state_read_connection_preface(int event, void *edata)
     this->sm_reader->consume(nbytes);
     HTTP2_SET_SESSION_HANDLER(&Http2ClientSession::state_start_frame_read);
 
-    // XXX set activity timeouts ...
+    client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::no_activity_timeout_in));
 
     // XXX start the write VIO ...