mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-17 04:51:03 +08:00
Set default socket in mg_connect() to -1
This commit is contained in:
parent
4e0039625e
commit
8c7fd8b330
@ -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->is_udp = (strncmp(url, "udp:", 4) == 0);
|
||||||
c->fn = fn;
|
c->fn = fn;
|
||||||
c->is_client = true;
|
c->is_client = true;
|
||||||
|
c->fd = (void *) (size_t) -1; // Set to invalid socket
|
||||||
c->fn_data = fn_data;
|
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_call(c, MG_EV_OPEN, NULL);
|
||||||
mg_resolve(c, url);
|
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 = fn;
|
||||||
c->fn_data = fn_data;
|
c->fn_data = fn_data;
|
||||||
mg_call(c, MG_EV_OPEN, NULL);
|
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;
|
return c;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user