From 414e0a2e60beaee1bf56c6e98d41fca2353af20c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Wed, 14 Aug 2019 14:23:46 -0400
Subject: [PATCH] proxy server: move type traits definition to cpp

---
 include/opendht/dht_proxy_server.h | 29 +++++++----------------------
 src/dht_proxy_server.cpp           | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/include/opendht/dht_proxy_server.h b/include/opendht/dht_proxy_server.h
index 98c1f1b1..4d8d00b6 100644
--- a/include/opendht/dht_proxy_server.h
+++ b/include/opendht/dht_proxy_server.h
@@ -52,28 +52,6 @@ namespace restinio {
     struct custom_http_methods_t;
 }
 
-using RestRouter = restinio::router::express_router_t<>;
-
-struct RestRouterTraitsTls : public restinio::default_tls_traits_t
-{
-    using timer_manager_t = restinio::asio_timer_manager_t;
-    using http_methods_mapper_t = restinio::custom_http_methods_t;
-    using logger_t = restinio::opendht_logger_t;
-    using request_handler_t = RestRouter;
-    using connection_state_listener_t = http::ConnectionListener;
-};
-struct RestRouterTraits : public restinio::default_traits_t
-{
-    using timer_manager_t = restinio::asio_timer_manager_t;
-    using http_methods_mapper_t = restinio::custom_http_methods_t;
-    using logger_t = restinio::opendht_logger_t;
-    using request_handler_t = RestRouter;
-    using connection_state_listener_t = http::ConnectionListener;
-};
-using RequestStatus = restinio::request_handling_status_t;
-using ResponseByParts = restinio::chunked_output_t;
-using ResponseByPartsBuilder = restinio::response_builder_t<ResponseByParts>;
-
 namespace Json {
     class Value;
 }
@@ -82,6 +60,13 @@ namespace dht {
 
 class DhtRunner;
 
+using RestRouter = restinio::router::express_router_t<>;
+struct RestRouterTraitsTls;
+struct RestRouterTraits;
+using RequestStatus = restinio::request_handling_status_t;
+using ResponseByParts = restinio::chunked_output_t;
+using ResponseByPartsBuilder = restinio::response_builder_t<ResponseByParts>;
+
 /**
  * Describes the REST API
  */
diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 5e96321e..0a4cc687 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -46,6 +46,27 @@ constexpr char RESP_MSG_PUT_FAILED[] = "{\"err\":\"Put failed\"}";
 
 constexpr const std::chrono::minutes PRINT_STATS_PERIOD {2};
 
+struct RestRouterTraitsTls : public restinio::default_tls_traits_t
+{
+    using timer_manager_t = restinio::asio_timer_manager_t;
+#ifdef OPENDHT_PROXY_HTTP_PARSER_FORK
+    using http_methods_mapper_t = restinio::custom_http_methods_t;
+#endif
+    using logger_t = restinio::opendht_logger_t;
+    using request_handler_t = RestRouter;
+    using connection_state_listener_t = http::ConnectionListener;
+};
+struct RestRouterTraits : public restinio::default_traits_t
+{
+    using timer_manager_t = restinio::asio_timer_manager_t;
+#ifdef OPENDHT_PROXY_HTTP_PARSER_FORK
+    using http_methods_mapper_t = restinio::custom_http_methods_t;
+#endif
+    using logger_t = restinio::opendht_logger_t;
+    using request_handler_t = RestRouter;
+    using connection_state_listener_t = http::ConnectionListener;
+};
+
 DhtProxyServer::DhtProxyServer(
     std::shared_ptr<dht::crypto::Identity> identity,
     std::shared_ptr<DhtRunner> dht, in_port_t port, const std::string& pushServer,
-- 
GitLab