mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-04-20 01:43:12 +02:00
Remove static handlers from http server.
This commit is contained in:
parent
23d085794c
commit
b8624f190a
@ -99,10 +99,10 @@ void HTTPServer::initialize() {
|
||||
builder.setAddr(false, "0.0.0.0", p_port);
|
||||
});
|
||||
|
||||
listenBuilder->configureEnterCallback([](const HttpSession::Ptr &httpSession, HttpSessionHandlers &handlers) {
|
||||
handlers.setHttpCallback(HTTPServer::httpEnterCallbackDefault);
|
||||
handlers.setClosedCallback(HTTPServer::closedCallbackDefault);
|
||||
handlers.setWSCallback(HTTPServer::wsEnterCallbackDefault);
|
||||
listenBuilder->configureEnterCallback([this](const HttpSession::Ptr &httpSession, HttpSessionHandlers &handlers) {
|
||||
handlers.setHttpCallback([this](const HTTPParser &httpParser, const HttpSession::Ptr &session){ this->httpEnterCallbackDefault(httpParser, session); });
|
||||
handlers.setWSCallback([this](const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload){ this->wsEnterCallbackDefault(httpSession, opcode, payload); });
|
||||
handlers.setClosedCallback([this](const HttpSession::Ptr &session){ this->closedCallbackDefault(session); });
|
||||
});
|
||||
|
||||
listenBuilder->asyncRun();
|
||||
@ -130,6 +130,3 @@ HTTPServer::HTTPServer() {
|
||||
HTTPServer::~HTTPServer() {
|
||||
delete listenBuilder;
|
||||
}
|
||||
|
||||
std::map<HttpSession *, Request *> HTTPServer::_request_map;
|
||||
std::mutex HTTPServer::_request_map_mutex;
|
||||
|
@ -27,11 +27,11 @@ public:
|
||||
std::shared_ptr<TcpService> service;
|
||||
wrapper::HttpListenerBuilder *listenBuilder;
|
||||
|
||||
static void http_callback_handler(Request *response);
|
||||
void http_callback_handler(Request *response);
|
||||
|
||||
static void httpEnterCallbackDefault(const HTTPParser &httpParser, const HttpSession::Ptr &session);
|
||||
static void wsEnterCallbackDefault(const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload);
|
||||
static void closedCallbackDefault(const HttpSession::Ptr &session);
|
||||
void httpEnterCallbackDefault(const HTTPParser &httpParser, const HttpSession::Ptr &session);
|
||||
void wsEnterCallbackDefault(const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload);
|
||||
void closedCallbackDefault(const HttpSession::Ptr &session);
|
||||
|
||||
virtual void configure();
|
||||
virtual void initialize();
|
||||
@ -42,8 +42,8 @@ public:
|
||||
virtual ~HTTPServer();
|
||||
|
||||
protected:
|
||||
static std::map<HttpSession *, Request *> _request_map;
|
||||
static std::mutex _request_map_mutex;
|
||||
std::map<HttpSession *, Request *> _request_map;
|
||||
std::mutex _request_map_mutex;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user