From e1a3ba0179fc93664a6e4e56d4731aef46fc886d Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 10 Feb 2022 09:42:13 +0100 Subject: [PATCH] Move the rest of the net related things from trantor to core. --- core/SCsub | 3 ++- .../net/connections/tcp_connection_impl.cpp | 2 +- .../net/connections/tcp_connection_impl.h | 2 +- .../net/inner/Connector.cc => core/net/connector.cpp | 2 +- .../trantor/net/inner/Connector.h => core/net/connector.h | 0 .../drogon/trantor/net/Resolver.h => core/net/resolver.h | 0 .../AresResolver.cc => core/net/resolvers/ares_resolver.cpp | 2 +- .../AresResolver.h => core/net/resolvers/ares_resolver.h | 2 +- .../net/resolvers/normal_resolver.cpp | 2 +- .../net/resolvers/normal_resolver.h | 2 +- .../trantor/net/TcpClient.cc => core/net/tcp_client.cpp | 6 +++--- .../drogon/trantor/net/TcpClient.h => core/net/tcp_client.h | 2 +- .../net/TcpConnection.h => core/net/tcp_connection.h | 0 .../trantor/net/TcpServer.cc => core/net/tcp_server.cpp | 4 ++-- .../drogon/trantor/net/TcpServer.h => core/net/tcp_server.h | 2 +- .../drogon/drogon/lib/inc/drogon/HttpAppFramework.h | 2 +- web_backends/drogon/drogon/lib/inc/http/HttpRequestParser.h | 2 +- .../drogon/drogon/lib/inc/http/HttpResponseParser.h | 2 +- web_backends/drogon/drogon/lib/src/HttpClientImpl.h | 4 ++-- web_backends/drogon/drogon/lib/src/HttpServer.h | 2 +- web_backends/drogon/drogon/lib/src/WebSocketClientImpl.h | 2 +- .../drogon/drogon/lib/src/WebSocketConnectionImpl.h | 2 +- .../drogon/drogon/lib/tests/integration_test/client/main.cc | 2 +- web_backends/drogon/drogon_web_server.cpp | 2 +- web_backends/drogon/drogon_web_server.h | 2 +- web_backends/drogon/trantor/tests/DelayedSSLClientTest.cc | 2 +- web_backends/drogon/trantor/tests/DelayedSSLServerTest.cc | 2 +- web_backends/drogon/trantor/tests/DnsTest.cc | 2 +- web_backends/drogon/trantor/tests/KickoffTest.cc | 2 +- web_backends/drogon/trantor/tests/SSLClientTest.cc | 2 +- web_backends/drogon/trantor/tests/SSLServerTest.cc | 2 +- web_backends/drogon/trantor/tests/SendfileTest.cc | 2 +- web_backends/drogon/trantor/tests/TcpClientTest.cc | 2 +- web_backends/drogon/trantor/tests/TcpServerTest.cc | 2 +- 34 files changed, 36 insertions(+), 35 deletions(-) rename web_backends/drogon/trantor/net/inner/TcpConnectionImpl.cc => core/net/connections/tcp_connection_impl.cpp (99%) rename web_backends/drogon/trantor/net/inner/TcpConnectionImpl.h => core/net/connections/tcp_connection_impl.h (99%) rename web_backends/drogon/trantor/net/inner/Connector.cc => core/net/connector.cpp (99%) rename web_backends/drogon/trantor/net/inner/Connector.h => core/net/connector.h (100%) rename web_backends/drogon/trantor/net/Resolver.h => core/net/resolver.h (100%) rename web_backends/drogon/trantor/net/inner/AresResolver.cc => core/net/resolvers/ares_resolver.cpp (99%) rename web_backends/drogon/trantor/net/inner/AresResolver.h => core/net/resolvers/ares_resolver.h (99%) rename web_backends/drogon/trantor/net/inner/NormalResolver.cc => core/net/resolvers/normal_resolver.cpp (98%) rename web_backends/drogon/trantor/net/inner/NormalResolver.h => core/net/resolvers/normal_resolver.h (98%) rename web_backends/drogon/trantor/net/TcpClient.cc => core/net/tcp_client.cpp (97%) rename web_backends/drogon/trantor/net/TcpClient.h => core/net/tcp_client.h (99%) rename web_backends/drogon/trantor/net/TcpConnection.h => core/net/tcp_connection.h (100%) rename web_backends/drogon/trantor/net/TcpServer.cc => core/net/tcp_server.cpp (98%) rename web_backends/drogon/trantor/net/TcpServer.h => core/net/tcp_server.h (99%) diff --git a/core/SCsub b/core/SCsub index 20daf41..2fbfa1d 100644 --- a/core/SCsub +++ b/core/SCsub @@ -7,8 +7,9 @@ env.core_sources = [] env.add_source_files(env.core_sources, "*.cpp") env.add_source_files(env.core_sources, "./math/*.cpp") env.add_source_files(env.core_sources, "./net/*.cpp") +env.add_source_files(env.core_sources, "./net/resolvers/*.cpp") +env.add_source_files(env.core_sources, "./net/connections/*.cpp") env.add_source_files(env.core_sources, "./loops/*.cpp") -#todo move these to modules env.add_source_files(env.core_sources, "./loops/poller/*.cpp") env.add_source_files(env.core_sources, "./containers/*.cpp") env.add_source_files(env.core_sources, "./log/*.cpp") diff --git a/web_backends/drogon/trantor/net/inner/TcpConnectionImpl.cc b/core/net/connections/tcp_connection_impl.cpp similarity index 99% rename from web_backends/drogon/trantor/net/inner/TcpConnectionImpl.cc rename to core/net/connections/tcp_connection_impl.cpp index dcf2196..bc9780b 100644 --- a/web_backends/drogon/trantor/net/inner/TcpConnectionImpl.cc +++ b/core/net/connections/tcp_connection_impl.cpp @@ -12,7 +12,7 @@ * */ -#include "TcpConnectionImpl.h" +#include "tcp_connection_impl.h" #include "core/loops/channel.h" #include "core/net/socket.h" #ifdef __linux__ diff --git a/web_backends/drogon/trantor/net/inner/TcpConnectionImpl.h b/core/net/connections/tcp_connection_impl.h similarity index 99% rename from web_backends/drogon/trantor/net/inner/TcpConnectionImpl.h rename to core/net/connections/tcp_connection_impl.h index 396dc7e..50d4a4c 100644 --- a/web_backends/drogon/trantor/net/inner/TcpConnectionImpl.h +++ b/core/net/connections/tcp_connection_impl.h @@ -14,7 +14,7 @@ #pragma once -#include +#include "core/net/tcp_connection.h" #include "core/loops/timing_wheel.h" #include #include diff --git a/web_backends/drogon/trantor/net/inner/Connector.cc b/core/net/connector.cpp similarity index 99% rename from web_backends/drogon/trantor/net/inner/Connector.cc rename to core/net/connector.cpp index cebdc00..fc11b45 100644 --- a/web_backends/drogon/trantor/net/inner/Connector.cc +++ b/core/net/connector.cpp @@ -12,7 +12,7 @@ * */ -#include "Connector.h" +#include "connector.h" #include "core/loops/channel.h" #include "core/net/socket.h" diff --git a/web_backends/drogon/trantor/net/inner/Connector.h b/core/net/connector.h similarity index 100% rename from web_backends/drogon/trantor/net/inner/Connector.h rename to core/net/connector.h diff --git a/web_backends/drogon/trantor/net/Resolver.h b/core/net/resolver.h similarity index 100% rename from web_backends/drogon/trantor/net/Resolver.h rename to core/net/resolver.h diff --git a/web_backends/drogon/trantor/net/inner/AresResolver.cc b/core/net/resolvers/ares_resolver.cpp similarity index 99% rename from web_backends/drogon/trantor/net/inner/AresResolver.cc rename to core/net/resolvers/ares_resolver.cpp index 6fad7aa..a1e90be 100644 --- a/web_backends/drogon/trantor/net/inner/AresResolver.cc +++ b/core/net/resolvers/ares_resolver.cpp @@ -5,7 +5,7 @@ // Author: Tao An -#include "AresResolver.h" +#include "ares_resolver.h" #include #include "core/loops/channel.h" #ifdef _WIN32 diff --git a/web_backends/drogon/trantor/net/inner/AresResolver.h b/core/net/resolvers/ares_resolver.h similarity index 99% rename from web_backends/drogon/trantor/net/inner/AresResolver.h rename to core/net/resolvers/ares_resolver.h index db3dfb8..598de21 100644 --- a/web_backends/drogon/trantor/net/inner/AresResolver.h +++ b/core/net/resolvers/ares_resolver.h @@ -6,7 +6,7 @@ // Author: Tao An #pragma once -#include +#include "core/net/resolver.h" #include #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/net/inner/NormalResolver.cc b/core/net/resolvers/normal_resolver.cpp similarity index 98% rename from web_backends/drogon/trantor/net/inner/NormalResolver.cc rename to core/net/resolvers/normal_resolver.cpp index 14dd8cd..69955de 100644 --- a/web_backends/drogon/trantor/net/inner/NormalResolver.cc +++ b/core/net/resolvers/normal_resolver.cpp @@ -1,4 +1,4 @@ -#include "NormalResolver.h" +#include "normal_resolver.h" #include "core/log/logger.h" #ifdef _WIN32 #include diff --git a/web_backends/drogon/trantor/net/inner/NormalResolver.h b/core/net/resolvers/normal_resolver.h similarity index 98% rename from web_backends/drogon/trantor/net/inner/NormalResolver.h rename to core/net/resolvers/normal_resolver.h index a743ae8..7bc674d 100644 --- a/web_backends/drogon/trantor/net/inner/NormalResolver.h +++ b/core/net/resolvers/normal_resolver.h @@ -6,7 +6,7 @@ // Author: Tao An #pragma once -#include +#include "core/net/resolver.h" #include #include "core/containers/concurrent_task_queue.h" #include diff --git a/web_backends/drogon/trantor/net/TcpClient.cc b/core/net/tcp_client.cpp similarity index 97% rename from web_backends/drogon/trantor/net/TcpClient.cc rename to core/net/tcp_client.cpp index 3362b69..f2853cf 100644 --- a/web_backends/drogon/trantor/net/TcpClient.cc +++ b/core/net/tcp_client.cpp @@ -9,10 +9,10 @@ // Taken from muduo and modified by an tao -#include +#include "core/net/tcp_client.h" -#include "Connector.h" -#include "inner/TcpConnectionImpl.h" +#include "connector.h" +#include "core/net/connections/tcp_connection_impl.h" #include "core/loops/event_loop.h" #include "core/log/logger.h" diff --git a/web_backends/drogon/trantor/net/TcpClient.h b/core/net/tcp_client.h similarity index 99% rename from web_backends/drogon/trantor/net/TcpClient.h rename to core/net/tcp_client.h index e3ef7b1..c7dd474 100644 --- a/web_backends/drogon/trantor/net/TcpClient.h +++ b/core/net/tcp_client.h @@ -19,7 +19,7 @@ #pragma once #include "core/loops/event_loop.h" #include "core/net/inet_address.h" -#include +#include "tcp_connection.h" #include #include #include diff --git a/web_backends/drogon/trantor/net/TcpConnection.h b/core/net/tcp_connection.h similarity index 100% rename from web_backends/drogon/trantor/net/TcpConnection.h rename to core/net/tcp_connection.h diff --git a/web_backends/drogon/trantor/net/TcpServer.cc b/core/net/tcp_server.cpp similarity index 98% rename from web_backends/drogon/trantor/net/TcpServer.cc rename to core/net/tcp_server.cpp index 428af38..68e25a5 100644 --- a/web_backends/drogon/trantor/net/TcpServer.cc +++ b/core/net/tcp_server.cpp @@ -13,8 +13,8 @@ */ #include "core/loops/acceptor.h" -#include "inner/TcpConnectionImpl.h" -#include +#include "core/net/connections/tcp_connection_impl.h" +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include #include diff --git a/web_backends/drogon/trantor/net/TcpServer.h b/core/net/tcp_server.h similarity index 99% rename from web_backends/drogon/trantor/net/TcpServer.h rename to core/net/tcp_server.h index facd6a0..3396f89 100644 --- a/web_backends/drogon/trantor/net/TcpServer.h +++ b/core/net/tcp_server.h @@ -18,7 +18,7 @@ #include "core/log/logger.h" #include "core/loops/event_loop_thread_pool.h" #include "core/net/inet_address.h" -#include +#include "core/net/tcp_connection.h" #include "core/loops/timing_wheel.h" #include #include diff --git a/web_backends/drogon/drogon/lib/inc/drogon/HttpAppFramework.h b/web_backends/drogon/drogon/lib/inc/drogon/HttpAppFramework.h index c29d0ed..7756a7e 100644 --- a/web_backends/drogon/drogon/lib/inc/drogon/HttpAppFramework.h +++ b/web_backends/drogon/drogon/lib/inc/drogon/HttpAppFramework.h @@ -26,7 +26,7 @@ #include #include #include "core/loops/event_loop.h" -#include +#include "core/net/resolver.h" #include #include #include diff --git a/web_backends/drogon/drogon/lib/inc/http/HttpRequestParser.h b/web_backends/drogon/drogon/lib/inc/http/HttpRequestParser.h index dd56745..becee1e 100644 --- a/web_backends/drogon/drogon/lib/inc/http/HttpRequestParser.h +++ b/web_backends/drogon/drogon/lib/inc/http/HttpRequestParser.h @@ -16,7 +16,7 @@ #include "../src/impl_forwards.h" #include -#include +#include "core/net/tcp_connection.h" #include "core/containers/msg_buffer.h" #include #include diff --git a/web_backends/drogon/drogon/lib/inc/http/HttpResponseParser.h b/web_backends/drogon/drogon/lib/inc/http/HttpResponseParser.h index 5abaec6..3cfd99a 100644 --- a/web_backends/drogon/drogon/lib/inc/http/HttpResponseParser.h +++ b/web_backends/drogon/drogon/lib/inc/http/HttpResponseParser.h @@ -15,7 +15,7 @@ #pragma once #include "../src/impl_forwards.h" -#include +#include "core/net/tcp_connection.h" #include "core/containers/msg_buffer.h" #include #include diff --git a/web_backends/drogon/drogon/lib/src/HttpClientImpl.h b/web_backends/drogon/drogon/lib/src/HttpClientImpl.h index 10b1603..1b6f184 100644 --- a/web_backends/drogon/drogon/lib/src/HttpClientImpl.h +++ b/web_backends/drogon/drogon/lib/src/HttpClientImpl.h @@ -18,8 +18,8 @@ #include #include #include "core/loops/event_loop.h" -#include -#include +#include "core/net/resolver.h" +#include "core/net/tcp_client.h" #include #include #include diff --git a/web_backends/drogon/drogon/lib/src/HttpServer.h b/web_backends/drogon/drogon/lib/src/HttpServer.h index a5c306d..c2729e6 100644 --- a/web_backends/drogon/drogon/lib/src/HttpServer.h +++ b/web_backends/drogon/drogon/lib/src/HttpServer.h @@ -15,7 +15,7 @@ #pragma once #include "impl_forwards.h" -#include +#include "core/net/tcp_server.h" #include "core/loops/callbacks.h" #include #include diff --git a/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.h b/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.h index 5ef3bad..49e884b 100644 --- a/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.h +++ b/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.h @@ -17,7 +17,7 @@ #include "impl_forwards.h" #include #include "core/loops/event_loop.h" -#include +#include "core/net/tcp_client.h" #include #include diff --git a/web_backends/drogon/drogon/lib/src/WebSocketConnectionImpl.h b/web_backends/drogon/drogon/lib/src/WebSocketConnectionImpl.h index eb42062..aaa61fc 100644 --- a/web_backends/drogon/drogon/lib/src/WebSocketConnectionImpl.h +++ b/web_backends/drogon/drogon/lib/src/WebSocketConnectionImpl.h @@ -16,7 +16,7 @@ #include "impl_forwards.h" #include -#include +#include "core/net/tcp_connection.h" #include namespace drogon { diff --git a/web_backends/drogon/drogon/lib/tests/integration_test/client/main.cc b/web_backends/drogon/drogon/lib/tests/integration_test/client/main.cc index 910a1eb..402e600 100644 --- a/web_backends/drogon/drogon/lib/tests/integration_test/client/main.cc +++ b/web_backends/drogon/drogon/lib/tests/integration_test/client/main.cc @@ -19,7 +19,7 @@ #include #include #include "core/loops/event_loop_thread.h" -#include +#include "core/net/tcp_client.h" #include #include diff --git a/web_backends/drogon/drogon_web_server.cpp b/web_backends/drogon/drogon_web_server.cpp index f451f1e..a0ecb7b 100644 --- a/web_backends/drogon/drogon_web_server.cpp +++ b/web_backends/drogon/drogon_web_server.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include "core/net/tcp_connection.h" #include "core/log/async_file_logger.h" #include diff --git a/web_backends/drogon/drogon_web_server.h b/web_backends/drogon/drogon_web_server.h index 834f11f..078763c 100644 --- a/web_backends/drogon/drogon_web_server.h +++ b/web_backends/drogon/drogon_web_server.h @@ -13,7 +13,7 @@ #include #include "core/net/inet_address.h" -#include +#include "core/net/resolver.h" #include "core/log/logger.h" #include "http/HttpRequestImpl.h" diff --git a/web_backends/drogon/trantor/tests/DelayedSSLClientTest.cc b/web_backends/drogon/trantor/tests/DelayedSSLClientTest.cc index 0e6f32e..ef463c6 100644 --- a/web_backends/drogon/trantor/tests/DelayedSSLClientTest.cc +++ b/web_backends/drogon/trantor/tests/DelayedSSLClientTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_client.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/DelayedSSLServerTest.cc b/web_backends/drogon/trantor/tests/DelayedSSLServerTest.cc index 83f16ce..72dca02 100644 --- a/web_backends/drogon/trantor/tests/DelayedSSLServerTest.cc +++ b/web_backends/drogon/trantor/tests/DelayedSSLServerTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/DnsTest.cc b/web_backends/drogon/trantor/tests/DnsTest.cc index 1a71f53..9f6bccc 100644 --- a/web_backends/drogon/trantor/tests/DnsTest.cc +++ b/web_backends/drogon/trantor/tests/DnsTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/resolver.h" #include void dns(const std::shared_ptr &resolver) { diff --git a/web_backends/drogon/trantor/tests/KickoffTest.cc b/web_backends/drogon/trantor/tests/KickoffTest.cc index ed8ead7..b957ce7 100644 --- a/web_backends/drogon/trantor/tests/KickoffTest.cc +++ b/web_backends/drogon/trantor/tests/KickoffTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/SSLClientTest.cc b/web_backends/drogon/trantor/tests/SSLClientTest.cc index bebb96a..7c6ffa5 100644 --- a/web_backends/drogon/trantor/tests/SSLClientTest.cc +++ b/web_backends/drogon/trantor/tests/SSLClientTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_client.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/SSLServerTest.cc b/web_backends/drogon/trantor/tests/SSLServerTest.cc index 53fc71a..cc231d4 100644 --- a/web_backends/drogon/trantor/tests/SSLServerTest.cc +++ b/web_backends/drogon/trantor/tests/SSLServerTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/SendfileTest.cc b/web_backends/drogon/trantor/tests/SendfileTest.cc index d5fed2d..310e37a 100644 --- a/web_backends/drogon/trantor/tests/SendfileTest.cc +++ b/web_backends/drogon/trantor/tests/SendfileTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/TcpClientTest.cc b/web_backends/drogon/trantor/tests/TcpClientTest.cc index ae64902..3bd0051 100644 --- a/web_backends/drogon/trantor/tests/TcpClientTest.cc +++ b/web_backends/drogon/trantor/tests/TcpClientTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_client.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include diff --git a/web_backends/drogon/trantor/tests/TcpServerTest.cc b/web_backends/drogon/trantor/tests/TcpServerTest.cc index 0e60947..5fc526b 100644 --- a/web_backends/drogon/trantor/tests/TcpServerTest.cc +++ b/web_backends/drogon/trantor/tests/TcpServerTest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/tcp_server.h" #include "core/log/logger.h" #include "core/loops/event_loop_thread.h" #include