diff --git a/mongoose.c b/mongoose.c index e80c7fcb..bf1fda09 100644 --- a/mongoose.c +++ b/mongoose.c @@ -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; diff --git a/src/net.c b/src/net.c index c6c500f0..c0a9e5fe 100644 --- a/src/net.c +++ b/src/net.c @@ -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;