mongoose/examples/device-dashboard/main.c

32 lines
590 B
C
Raw Normal View History

2023-05-26 22:48:20 +08:00
// Copyright (c) 2020-2023 Cesanta Software Limited
2020-12-05 19:26:32 +08:00
// All rights reserved
2023-05-26 22:48:20 +08:00
#include "net.h"
2023-02-23 03:38:21 +08:00
2023-05-26 22:48:20 +08:00
static int s_sig_num;
static void signal_handler(int sig_num) {
signal(sig_num, signal_handler);
s_sig_num = sig_num;
}
2020-12-05 19:26:32 +08:00
int main(void) {
struct mg_mgr mgr;
2023-05-26 22:48:20 +08:00
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
2022-08-01 18:19:32 +08:00
mg_log_set(MG_LL_DEBUG); // Set debug log level
2020-12-05 19:26:32 +08:00
mg_mgr_init(&mgr);
2023-05-26 22:48:20 +08:00
web_init(&mgr);
while (s_sig_num == 0) {
mg_mgr_poll(&mgr, 50);
}
2022-05-15 21:40:58 +08:00
mg_mgr_free(&mgr);
2023-05-26 22:48:20 +08:00
MG_INFO(("Exiting on signal %d", s_sig_num));
2020-12-05 19:26:32 +08:00
return 0;
}