SpiecsEngine
 
Loading...
Searching...
No Matches
Spices::Net::HttpServer Class Reference

#include <HttpServer.h>

Public Types

using HttpCallback = std::function<void(const HttpRequest&, HttpResponse*)>
 
using WeakTcpConnectionPtr = std::weak_ptr<TcpConnection>
 
using WeakConnectionList = std::list<WeakTcpConnectionPtr>
 
using Node = WeakConnectionList::iterator
 
using NameNode = std::unordered_map<std::string, Node>
 

Public Member Functions

 HttpServer (const InetAddress &listenAddress, int idleSeconds, TcpServer::Option option=TcpServer::Option::NoReusePort)
 Constructor Function.
 
virtual ~HttpServer ()=default
 Destructor Function.
 
 HttpServer (const HttpServer &)=delete
 Copy Constructor Function.
 
HttpServeroperator= (const HttpServer &)=delete
 Copy Assignment Operation.
 
void Start (int threadSize) const
 Start ThreadPool and call listen on acceptor.
 

Private Member Functions

void OnConnection (const TcpConnectionPtr &connection)
 
void OnMessage (const TcpConnectionPtr &connection, Buffer *buf)
 
void OnRequest (const TcpConnectionPtr &connection, const HttpRequest &request)
 

Private Attributes

TcpServer m_Server
 
HttpCallback m_HttpCallback
 
int m_IdleSeconds
 
WeakConnectionList m_ConnectionList
 
NameNode m_NameNodeMap
 

Detailed Description

Definition at line 18 of file HttpServer.h.


The documentation for this class was generated from the following files: