mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-19 11:09:42 +00:00
Fix #1445 - send error to a resolving connection when DNS error happens
This commit is contained in:
1 parent
5fc284722f
commit
9fd80fd136
4 files changed
+28
-17
No files matched your search
@@ -183,6 +183,7 @@ static void dns_cb(struct mg_connection *c, int ev, void *ev_data,
|
||||
} else if (ev == MG_EV_CLOSE) {
|
||||
for (d = s_reqs; d != NULL; d = tmp) {
|
||||
tmp = d->next;
|
||||
mg_error(d->c, "DNS error");
|
||||
mg_dns_free(d);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -361,7 +361,9 @@ void mg_connect_resolved(struct mg_connection *c) {
|
||||
struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
|
||||
mg_event_handler_t fn, void *fn_data) {
|
||||
struct mg_connection *c = NULL;
|
||||
if ((c = alloc_conn(mgr, 1, INVALID_SOCKET)) == NULL) {
|
||||
if (url == NULL || url[0] == '\0') {
|
||||
LOG(LL_ERROR, ("null url"));
|
||||
} else if ((c = alloc_conn(mgr, 1, INVALID_SOCKET)) == NULL) {
|
||||
LOG(LL_ERROR, ("OOM"));
|
||||
} else {
|
||||
LIST_ADD_HEAD(struct mg_connection, &mgr->conns, c);
|
||||
|
||||
Reference in new issue
Block a user