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 e8c6b97  Add QUICConfig and proxy.config.quic.no_activity_timeout_in
e8c6b97 is described below

commit e8c6b978ed02ea96b80901f662a47a07d89c34ef
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Aug 10 15:34:56 2017 +0900

    Add QUICConfig and proxy.config.quic.no_activity_timeout_in
    
    Add QUICConfig class to load configs related to QUIC.
    "proxy.config.quic.no_activity_timeout_in" is also added. Default value is 
30 seconds.
---
 iocore/net/QUICNetProcessor.cc   |  6 ++--
 iocore/net/QUICNetVConnection.cc |  8 +++--
 iocore/net/quic/Makefile.am      |  1 +
 iocore/net/quic/QUICConfig.cc    | 74 ++++++++++++++++++++++++++++++++++++++++
 iocore/net/quic/QUICConfig.h     | 51 +++++++++++++++++++++++++++
 mgmt/RecordsConfig.cc            |  8 +++++
 6 files changed, 141 insertions(+), 7 deletions(-)

diff --git a/iocore/net/QUICNetProcessor.cc b/iocore/net/QUICNetProcessor.cc
index 40eb37e..7500ab1 100644
--- a/iocore/net/QUICNetProcessor.cc
+++ b/iocore/net/QUICNetProcessor.cc
@@ -24,6 +24,7 @@
 #include "P_Net.h"
 #include "ts/I_Layout.h"
 #include "I_RecHttp.h"
+#include "QUICConfig.h"
 // #include "P_QUICUtils.h"
 
 //
@@ -52,10 +53,7 @@ QUICNetProcessor::start(int, size_t stacksize)
 {
   // This initialization order matters ...
   // QUICInitializeLibrary();
-  // QUICConfig::startup();
-
-  // if (!QUICCertificateConfig::startup())
-  //   return -1;
+  QUICConfig::startup();
 
   // Acquire a QUICConfigParams instance *after* we start QUIC up.
   // QUICConfig::scoped_config params;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 5eb4130..9898712 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -36,6 +36,7 @@
 #include "QUICEchoApp.h"
 #include "QUICDebugNames.h"
 #include "QUICEvents.h"
+#include "QUICConfig.h"
 
 #define STATE_FROM_VIO(_x) ((NetState *)(((char *)(_x)) - STATE_VIO_OFFSET))
 #define STATE_VIO_OFFSET ((uintptr_t) & ((NetState *)0)->vio)
@@ -267,9 +268,10 @@ QUICNetVConnection::state_handshake(int event, Event *data)
     this->_state = QUICConnectionState::Established;
     
SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_established);
 
-    // TODO: switch waiting for a CONNECTION_CLOSE frame for first 
implementation
-    // TODO: read idle_timeout from Transport Prameters
-    ink_hrtime idle_timeout = HRTIME_SECONDS(3);
+    QUICConfig::scoped_config params;
+
+    // TODO:  use idle_timeout from negotiated Transport Prameters
+    ink_hrtime idle_timeout = HRTIME_SECONDS(params->no_activity_timeout_in());
     this->set_inactivity_timeout(idle_timeout);
     this->add_to_active_queue();
   }
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index b0b799a..714874c 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -56,6 +56,7 @@ libquic_a_SOURCES = \
   QUICCrypto.cc \
   $(QUICCrypto_impl) \
   QUICAckFrameCreator.cc \
+  QUICConfig.cc \
   QUICDebugNames.cc \
   QUICApplication.cc \
   QUICEchoApp.cc
diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
new file mode 100644
index 0000000..64b8e90
--- /dev/null
+++ b/iocore/net/quic/QUICConfig.cc
@@ -0,0 +1,74 @@
+/** @file
+ *
+ *  A brief file description
+ *
+ *  @section license License
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include "QUICConfig.h"
+
+#include <records/I_RecHttp.h>
+
+int QUICConfig::_config_id = 0;
+
+//
+// QUICConfigParams
+//
+void
+QUICConfigParams::initialize()
+{
+  REC_EstablishStaticConfigInt32U(this->_no_activity_timeout_in, 
"proxy.config.quic.no_activity_timeout_in");
+}
+
+uint32_t
+QUICConfigParams::no_activity_timeout_in() const
+{
+  return this->_no_activity_timeout_in;
+}
+
+//
+// QUICConfig
+//
+void
+QUICConfig::startup()
+{
+  reconfigure();
+}
+
+void
+QUICConfig::reconfigure()
+{
+  QUICConfigParams *params;
+  params = new QUICConfigParams;
+  // re-read configuration
+  params->initialize();
+  _config_id = configProcessor.set(_config_id, params);
+}
+
+QUICConfigParams *
+QUICConfig::acquire()
+{
+  return static_cast<QUICConfigParams *>(configProcessor.get(_config_id));
+}
+
+void
+QUICConfig::release(QUICConfigParams *params)
+{
+  configProcessor.release(_config_id, params);
+}
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
new file mode 100644
index 0000000..e4139bb
--- /dev/null
+++ b/iocore/net/quic/QUICConfig.h
@@ -0,0 +1,51 @@
+/** @file
+ *
+ *  A brief file description
+ *
+ *  @section license License
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#pragma once
+
+#include "ProxyConfig.h"
+
+class QUICConfigParams : public ConfigInfo
+{
+public:
+  void initialize();
+
+  uint32_t no_activity_timeout_in() const;
+
+private:
+  uint32_t _no_activity_timeout_in = 0;
+};
+
+class QUICConfig
+{
+public:
+  static void startup();
+  static void reconfigure();
+  static QUICConfigParams *acquire();
+  static void release(QUICConfigParams *params);
+
+  using scoped_config = ConfigProcessor::scoped_config<QUICConfig, 
QUICConfigParams>;
+
+private:
+  static int _config_id;
+};
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 39bce05..f16fd2b 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1328,6 +1328,14 @@ static const RecordElement RecordsConfig[] =
   {RECT_CONFIG, "proxy.config.http2.active_timeout_in", RECD_INT, "900", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
 
+  //############
+  //#
+  //# QUIC global configuration.
+  //#
+  //############
+  {RECT_CONFIG, "proxy.config.quic.no_activity_timeout_in", RECD_INT, "30", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
+  ,
+
   //# Add LOCAL Records Here
   {RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, nullptr, 
RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,

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

Reply via email to