From 65cdbf34be63e7af1e735d395abe4f2585edcade Mon Sep 17 00:00:00 2001 From: xiehan <52160700+Barenboim@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:23:03 +0800 Subject: [PATCH] Remove 'WFHttpServerTask.h' (#1653) --- BUILD | 1 - CMakeLists_Headers.txt | 1 - src/factory/HttpTaskImpl.cc | 31 +++++++++++++++ src/factory/WFHttpServerTask.h | 50 ------------------------- src/factory/WFTaskFactory.inl | 14 +++---- src/include/workflow/WFHttpServerTask.h | 1 - 6 files changed, 36 insertions(+), 62 deletions(-) delete mode 100644 src/factory/WFHttpServerTask.h delete mode 120000 src/include/workflow/WFHttpServerTask.h diff --git a/BUILD b/BUILD index 63394bef0e..ebb20ffd12 100644 --- a/BUILD +++ b/BUILD @@ -93,7 +93,6 @@ cc_library( 'src/protocol/HttpMessage.h', 'src/protocol/HttpUtil.h', 'src/protocol/http_parser.h', - 'src/factory/WFHttpServerTask.h', 'src/server/WFHttpServer.h', ], includes = [ diff --git a/CMakeLists_Headers.txt b/CMakeLists_Headers.txt index 07a3dcfb75..78f341e5ca 100644 --- a/CMakeLists_Headers.txt +++ b/CMakeLists_Headers.txt @@ -89,7 +89,6 @@ set(INCLUDE_HEADERS src/factory/WFOperator.h src/factory/WFResourcePool.h src/factory/WFMessageQueue.h - src/factory/WFHttpServerTask.h src/factory/RedisTaskImpl.inl src/nameservice/WFNameService.h src/nameservice/WFDnsResolver.h diff --git a/src/factory/HttpTaskImpl.cc b/src/factory/HttpTaskImpl.cc index b929610d67..58208761a1 100644 --- a/src/factory/HttpTaskImpl.cc +++ b/src/factory/HttpTaskImpl.cc @@ -911,6 +911,29 @@ WFHttpTask *WFTaskFactory::create_http_task(const ParsedURI& uri, /**********Server**********/ +class WFHttpServerTask : public WFServerTask +{ +private: + using TASK = WFNetworkTask; + +public: + WFHttpServerTask(CommService *service, std::function& proc) : + WFServerTask(service, WFGlobal::get_scheduler(), proc), + req_is_alive_(false), + req_has_keep_alive_header_(false) + {} + +protected: + virtual void handle(int state, int error); + virtual CommMessageOut *message_out(); + +protected: + bool req_is_alive_; + bool req_has_keep_alive_header_; + std::string req_keep_alive_; +}; + void WFHttpServerTask::handle(int state, int error) { if (state == WFT_STATE_TOREPLY) @@ -1044,3 +1067,11 @@ CommMessageOut *WFHttpServerTask::message_out() return this->WFServerTask::message_out(); } +/**********Server Factory**********/ + +WFHttpTask *WFServerTaskFactory::create_http_task(CommService *service, + std::function& process) +{ + return new WFHttpServerTask(service, process); +} + diff --git a/src/factory/WFHttpServerTask.h b/src/factory/WFHttpServerTask.h deleted file mode 100644 index 93c073f2bb..0000000000 --- a/src/factory/WFHttpServerTask.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2023 Sogou, Inc. - - Licensed 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. - - Authors: Xie Han (xiehan@sogou-inc.com) -*/ - -#ifndef _WFHTTPSERVERTASK_H_ -#define _WFHTTPSERVERTASK_H_ - -#include "HttpMessage.h" -#include "WFTask.h" -#include "WFGlobal.h" - -class WFHttpServerTask : public WFServerTask -{ -private: - using TASK = WFNetworkTask; - -public: - WFHttpServerTask(CommService *service, std::function& proc) : - WFServerTask(service, WFGlobal::get_scheduler(), proc), - req_is_alive_(false), - req_has_keep_alive_header_(false) - {} - -protected: - virtual void handle(int state, int error); - virtual CommMessageOut *message_out(); - -protected: - bool req_is_alive_; - bool req_has_keep_alive_header_; - std::string req_keep_alive_; -}; - -#endif - diff --git a/src/factory/WFTaskFactory.inl b/src/factory/WFTaskFactory.inl index 84c4c86544..07bd44397f 100644 --- a/src/factory/WFTaskFactory.inl +++ b/src/factory/WFTaskFactory.inl @@ -37,7 +37,6 @@ #include "WFTaskError.h" #include "EndpointParams.h" #include "WFNameService.h" -#include "WFHttpServerTask.h" class __WFDynamicTask : public WFDynamicTask { @@ -576,9 +575,9 @@ WFNetworkTaskFactory::create_client_task(enum TransportType type, template WFNetworkTask * WFNetworkTaskFactory::create_server_task(CommService *service, - std::function *)>& proc) + std::function *)>& process) { - return new WFServerTask(service, WFGlobal::get_scheduler(), proc); + return new WFServerTask(service, WFGlobal::get_scheduler(), process); } /**********Server Factory**********/ @@ -587,16 +586,13 @@ class WFServerTaskFactory { public: static WFDnsTask *create_dns_task(CommService *service, - std::function& proc); + std::function& process); static WFHttpTask *create_http_task(CommService *service, - std::function& proc) - { - return new WFHttpServerTask(service, proc); - } + std::function& process); static WFMySQLTask *create_mysql_task(CommService *service, - std::function& proc); + std::function& process); }; /************Go Task Factory************/ diff --git a/src/include/workflow/WFHttpServerTask.h b/src/include/workflow/WFHttpServerTask.h deleted file mode 120000 index fb8d9812fb..0000000000 --- a/src/include/workflow/WFHttpServerTask.h +++ /dev/null @@ -1 +0,0 @@ -../../factory/WFHttpServerTask.h \ No newline at end of file