Set default socket in mg_connect() to -1

This commit is contained in:
Sergey Lyubka 2022-04-01 15:40:53 +01:00
parent 4e0039625e
commit 8c7fd8b330

View File

@ -175,8 +175,9 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
c->is_udp = (strncmp(url, "udp:", 4) == 0);
c->fn = fn;
c->is_client = true;
c->fd = (void *) (size_t) -1; // Set to invalid socket
c->fn_data = fn_data;
MG_DEBUG(("%lu -> %s", c->id, url));
MG_DEBUG(("%lu %p %s", c->id, c->fd, url));
mg_call(c, MG_EV_OPEN, NULL);
mg_resolve(c, url);
}
@ -198,7 +199,7 @@ struct mg_connection *mg_listen(struct mg_mgr *mgr, const char *url,
c->fn = fn;
c->fn_data = fn_data;
mg_call(c, MG_EV_OPEN, NULL);
MG_DEBUG(("%lu %s %p", c->id, url, c->fd));
MG_DEBUG(("%lu %p %s", c->id, c->fd, url));
}
return c;
}