mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-02 13:47:56 +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);
|
builder.setAddr(false, "0.0.0.0", p_port);
|
||||||
});
|
});
|
||||||
|
|
||||||
listenBuilder->configureEnterCallback([](const HttpSession::Ptr &httpSession, HttpSessionHandlers &handlers) {
|
listenBuilder->configureEnterCallback([this](const HttpSession::Ptr &httpSession, HttpSessionHandlers &handlers) {
|
||||||
handlers.setHttpCallback(HTTPServer::httpEnterCallbackDefault);
|
handlers.setHttpCallback([this](const HTTPParser &httpParser, const HttpSession::Ptr &session){ this->httpEnterCallbackDefault(httpParser, session); });
|
||||||
handlers.setClosedCallback(HTTPServer::closedCallbackDefault);
|
handlers.setWSCallback([this](const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload){ this->wsEnterCallbackDefault(httpSession, opcode, payload); });
|
||||||
handlers.setWSCallback(HTTPServer::wsEnterCallbackDefault);
|
handlers.setClosedCallback([this](const HttpSession::Ptr &session){ this->closedCallbackDefault(session); });
|
||||||
});
|
});
|
||||||
|
|
||||||
listenBuilder->asyncRun();
|
listenBuilder->asyncRun();
|
||||||
@ -130,6 +130,3 @@ HTTPServer::HTTPServer() {
|
|||||||
HTTPServer::~HTTPServer() {
|
HTTPServer::~HTTPServer() {
|
||||||
delete listenBuilder;
|
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;
|
std::shared_ptr<TcpService> service;
|
||||||
wrapper::HttpListenerBuilder *listenBuilder;
|
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);
|
void httpEnterCallbackDefault(const HTTPParser &httpParser, const HttpSession::Ptr &session);
|
||||||
static void wsEnterCallbackDefault(const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload);
|
void wsEnterCallbackDefault(const HttpSession::Ptr &httpSession, WebSocketFormat::WebSocketFrameType opcode, const std::string &payload);
|
||||||
static void closedCallbackDefault(const HttpSession::Ptr &session);
|
void closedCallbackDefault(const HttpSession::Ptr &session);
|
||||||
|
|
||||||
virtual void configure();
|
virtual void configure();
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
@ -42,8 +42,8 @@ public:
|
|||||||
virtual ~HTTPServer();
|
virtual ~HTTPServer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static std::map<HttpSession *, Request *> _request_map;
|
std::map<HttpSession *, Request *> _request_map;
|
||||||
static std::mutex _request_map_mutex;
|
std::mutex _request_map_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user