Merge pull request #1805 from cesanta/invsock

Fix unintended socket close on systems with valid fd=0 descriptor numbering
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2022-10-20 11:04:03 -03:00
commit 04cfcf751e
2 files changed
+2

No files matched your search

+1
View File
@@ -3432,6 +3432,7 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
} else {
LIST_ADD_HEAD(struct mg_connection, &mgr->conns, c);
c->is_udp = (strncmp(url, "udp:", 4) == 0);
c->fd = (void *) (size_t) -1; // Set to INVALID_SOCKET
c->fn = fn;
c->is_client = true;
c->fn_data = fn_data;
+1
View File
@@ -174,6 +174,7 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
} else {
LIST_ADD_HEAD(struct mg_connection, &mgr->conns, c);
c->is_udp = (strncmp(url, "udp:", 4) == 0);
c->fd = (void *) (size_t) -1; // Set to INVALID_SOCKET
c->fn = fn;
c->is_client = true;
c->fn_data = fn_data;