重构
This commit is contained in:
1 parent
384aade1a8
commit
bfe5b0ee12
82 files changed
+11652
-3978
No files matched your search
+13
-14
@@ -2,34 +2,33 @@
|
||||
#define WXHELPER_HTTP_SERVER_H_
|
||||
|
||||
#include <mongoose.h>
|
||||
|
||||
#include "http_handler.h"
|
||||
namespace wxhelper {
|
||||
class HttpServer {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static HttpServer &GetInstance();
|
||||
bool HttpStart();
|
||||
bool HttpClose();
|
||||
void Init(int port);
|
||||
|
||||
private:
|
||||
HttpServer(){}
|
||||
HttpServer(const HttpServer &) = delete;
|
||||
HttpServer &operator=(const HttpServer &) = delete;
|
||||
~HttpServer();
|
||||
static void StartHttpServer();
|
||||
static void EventHandler(struct mg_connection *c, int ev, void *ev_data, void *fn_data);
|
||||
void HandleHttpRequest(struct mg_connection *c, void *ev_data);
|
||||
void HandleWebsocketRequest(struct mg_connection *c, void *ev_data);
|
||||
|
||||
private:
|
||||
HttpServer(){};
|
||||
HttpServer(const HttpServer &) = delete;
|
||||
HttpServer &operator=(const HttpServer &) = delete;
|
||||
~HttpServer();
|
||||
static void StartHttpServer();
|
||||
static void EventHandler(struct mg_connection *c, int ev, void *ev_data,
|
||||
void *fn_data);
|
||||
void HandleHttpRequest(struct mg_connection *c, void *ev_data);
|
||||
void HandleWebsocketRequest(struct mg_connection *c, void *ev_data);
|
||||
|
||||
private:
|
||||
int port_;
|
||||
bool running_;
|
||||
struct mg_mgr mgr_;
|
||||
HttpHandler* http_handler_;
|
||||
HttpHandler *http_handler_;
|
||||
HANDLE thread_;
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
|
||||
Reference in new issue
Block a user