mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +00:00
Exporting only dashboard func
This commit is contained in:
1 parent
cf7d1d8041
commit
95e22e8d4f
2 files changed
+6
-10
No files matched your search
@@ -3,11 +3,13 @@
|
||||
|
||||
#include "mongoose.h"
|
||||
|
||||
extern void run_web_server(struct mg_mgr *);
|
||||
void device_dashboard_fn(struct mg_connection *, int, void *, void *);
|
||||
|
||||
int main(void) {
|
||||
struct mg_mgr mgr;
|
||||
mg_mgr_init(&mgr);
|
||||
run_web_server(&mgr);
|
||||
mg_http_listen(&mgr, "http://0.0.0.0:8000", device_dashboard_fn, &mgr);
|
||||
for (;;) mg_mgr_poll(&mgr, 1000);
|
||||
mg_mgr_free(&mgr);
|
||||
return 0;
|
||||
}
|
||||
@@ -75,7 +75,8 @@ static void send_notification(struct mg_mgr *mgr, const char *name,
|
||||
}
|
||||
|
||||
// HTTP request handler function
|
||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
void device_dashboard_fn(struct mg_connection *c, int ev, void *ev_data,
|
||||
void *fn_data) {
|
||||
if (ev == MG_EV_HTTP_MSG) {
|
||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||
struct user *u = getuser(hm);
|
||||
@@ -124,10 +125,3 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void run_web_server(struct mg_mgr *mgr) {
|
||||
s_config.value2 = strdup("hello");
|
||||
mg_http_listen(mgr, "http://0.0.0.0:8000", fn, mgr);
|
||||
for (;;) mg_mgr_poll(mgr, 1000);
|
||||
mg_mgr_free(mgr);
|
||||
}
|
||||
Reference in new issue
Block a user