fix SNTP through proper protocol handler setup

This commit is contained in:
Sergio R. Caprile committed 2025-07-11 16:56:12 -03:00
1 parent 67255ce8f5
commit 8bf9d09d96
8 files changed
+39 -30

No files matched your search

+9 -2
View File
@@ -156,8 +156,8 @@ void mg_close_conn(struct mg_connection *c) {
mg_free(c);
}
struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
mg_event_handler_t fn, void *fn_data) {
struct mg_connection *mg_connect_svc(struct mg_mgr *mgr, const char *url,
mg_event_handler_t fn, void *fn_data, mg_event_handler_t pfn, void *pfn_data) {
struct mg_connection *c = NULL;
if (url == NULL || url[0] == '\0') {
MG_ERROR(("null url"));
@@ -171,6 +171,8 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
c->is_client = true;
c->fn_data = fn_data;
c->is_tls = (mg_url_is_ssl(url) != 0);
c->pfn = pfn;
c->pfn_data = pfn_data;
mg_call(c, MG_EV_OPEN, (void *) url);
MG_DEBUG(("%lu %ld %s", c->id, c->fd, url));
mg_resolve(c, url);
@@ -178,6 +180,11 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
return c;
}
struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
mg_event_handler_t fn, void *fn_data) {
return mg_connect_svc(mgr, url, fn, fn_data, NULL, NULL);
}
struct mg_connection *mg_listen(struct mg_mgr *mgr, const char *url,
mg_event_handler_t fn, void *fn_data) {
struct mg_connection *c = NULL;