]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3477] Checkpoint: fixed timeouts
authorFrancis Dupont <fdupont@isc.org>
Tue, 9 Jul 2024 08:17:20 +0000 (10:17 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 1 Aug 2024 07:23:53 +0000 (09:23 +0200)
src/lib/config/http_command_mgr.cc
src/lib/config/http_command_mgr.h

index bc9ad2a27b12056d1471f9c6d55a15c7f3372508..df2b6ced907bc83a1cf23fe8d37a4787fc8e0a85 100644 (file)
@@ -30,7 +30,8 @@ public:
 
     /// @brief Constructor.
     HttpCommandMgrImpl()
-        : io_service_(), timeout_(TIMEOUT_DHCP_SERVER_RECEIVE_COMMAND),
+        : io_service_(), timeout_(TIMEOUT_AGENT_RECEIVE_COMMAND),
+          idle_timeout_(TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT),
           current_config_(), http_listeners_(), active_(0) {
     }
 
@@ -54,6 +55,9 @@ public:
     /// @brief Connection timeout.
     long timeout_;
 
+    /// @brief Idle connection timeout.
+    long idle_timeout_;
+
     /// @brief Current config.
     HttpCommandConfigPtr current_config_;
 
@@ -125,8 +129,8 @@ HttpCommandMgrImpl::configure(HttpCommandConfigPtr config) {
                           server_port,
                           tls_context,
                           rfc,
-                          HttpListener::RequestTimeout(TIMEOUT_AGENT_RECEIVE_COMMAND),
-                          HttpListener::IdleTimeout(TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT)));
+                          HttpListener::RequestTimeout(timeout_),
+                          HttpListener::IdleTimeout(idle_timeout_)));
     // Instruct the HTTP listener to actually open socket, install
     // callback and start listening.
     http_listener->start();
@@ -214,6 +218,11 @@ HttpCommandMgr::setConnectionTimeout(const long timeout) {
     impl_->timeout_ = timeout;
 }
 
+void
+HttpCommandMgr::setIdleConnectionTimeout(const long timeout) {
+    impl_->idle_timeout_ = timeout;
+}
+
 void
 HttpCommandMgr::configure(HttpCommandConfigPtr config) {
     impl_->configure(config);
index 10f1d8b3705920458eb679ff7d4d76516f99aa5c..fb66c1a9e61d67b15cfa9a50aeea18d7962dfae1 100644 (file)
@@ -43,6 +43,11 @@ public:
     /// @param timeout New connection timeout in milliseconds.
     void setConnectionTimeout(const long timeout);
 
+    /// @brief Override default idle connection timeout.
+    ///
+    /// @param timeout New connection timeout in milliseconds.
+    void setIdleConnectionTimeout(const long timeout);
+
     /// @brief Configure control socket from configuration.
     ///
     /// @param config Configuration of the control socket.