Skip to content

Commit

Permalink
Remove 'WFHttpServerTask.h' (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Nov 11, 2024
1 parent a020251 commit 65cdbf3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 62 deletions.
1 change: 0 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion CMakeLists_Headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions src/factory/HttpTaskImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,29 @@ WFHttpTask *WFTaskFactory::create_http_task(const ParsedURI& uri,

/**********Server**********/

class WFHttpServerTask : public WFServerTask<protocol::HttpRequest,
protocol::HttpResponse>
{
private:
using TASK = WFNetworkTask<protocol::HttpRequest, protocol::HttpResponse>;

public:
WFHttpServerTask(CommService *service, std::function<void (TASK *)>& 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)
Expand Down Expand Up @@ -1044,3 +1067,11 @@ CommMessageOut *WFHttpServerTask::message_out()
return this->WFServerTask::message_out();
}

/**********Server Factory**********/

WFHttpTask *WFServerTaskFactory::create_http_task(CommService *service,
std::function<void (WFHttpTask *)>& process)
{
return new WFHttpServerTask(service, process);
}

50 changes: 0 additions & 50 deletions src/factory/WFHttpServerTask.h

This file was deleted.

14 changes: 5 additions & 9 deletions src/factory/WFTaskFactory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "WFTaskError.h"
#include "EndpointParams.h"
#include "WFNameService.h"
#include "WFHttpServerTask.h"

class __WFDynamicTask : public WFDynamicTask
{
Expand Down Expand Up @@ -576,9 +575,9 @@ WFNetworkTaskFactory<REQ, RESP>::create_client_task(enum TransportType type,
template<class REQ, class RESP>
WFNetworkTask<REQ, RESP> *
WFNetworkTaskFactory<REQ, RESP>::create_server_task(CommService *service,
std::function<void (WFNetworkTask<REQ, RESP> *)>& proc)
std::function<void (WFNetworkTask<REQ, RESP> *)>& process)
{
return new WFServerTask<REQ, RESP>(service, WFGlobal::get_scheduler(), proc);
return new WFServerTask<REQ, RESP>(service, WFGlobal::get_scheduler(), process);
}

/**********Server Factory**********/
Expand All @@ -587,16 +586,13 @@ class WFServerTaskFactory
{
public:
static WFDnsTask *create_dns_task(CommService *service,
std::function<void (WFDnsTask *)>& proc);
std::function<void (WFDnsTask *)>& process);

static WFHttpTask *create_http_task(CommService *service,
std::function<void (WFHttpTask *)>& proc)
{
return new WFHttpServerTask(service, proc);
}
std::function<void (WFHttpTask *)>& process);

static WFMySQLTask *create_mysql_task(CommService *service,
std::function<void (WFMySQLTask *)>& proc);
std::function<void (WFMySQLTask *)>& process);
};

/************Go Task Factory************/
Expand Down
1 change: 0 additions & 1 deletion src/include/workflow/WFHttpServerTask.h

This file was deleted.

0 comments on commit 65cdbf3

Please sign in to comment.