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 2022-10-20 11:04:03 -03:00 committed by GitHub
commit 04cfcf751e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

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;

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;