mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-23 11:44:53 +00:00
fix SNTP through proper protocol handler setup
This commit is contained in:
1 parent
67255ce8f5
commit
8bf9d09d96
8 files changed
+39
-30
No files matched your search
@@ -44,8 +44,11 @@ static void sfn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
// Called every 5 seconds. Increase that for production case.
|
||||
static void timer_fn(void *arg) {
|
||||
struct mg_mgr *mgr = (struct mg_mgr *) arg;
|
||||
if (s_sntp_conn == NULL) s_sntp_conn = mg_sntp_connect(mgr, NULL, sfn, NULL);
|
||||
if (s_sntp_conn != NULL) mg_sntp_request(s_sntp_conn);
|
||||
if (s_sntp_conn == NULL) { // connection issues a request
|
||||
s_sntp_conn = mg_sntp_connect(mgr, NULL, sfn, NULL);
|
||||
} else {
|
||||
mg_sntp_request(s_sntp_conn);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
Reference in new issue
Block a user