mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
async-dns: fix error path
This commit is contained in:
parent
06b39e3315
commit
a1d86d89fa
1 changed files with 7 additions and 2 deletions
|
@ -88,13 +88,17 @@ lws_async_dns_complete(lws_adns_q_t *q, lws_adns_cache_t *c)
|
|||
__func__, q, c, c->refcount, c->refcount + 1);
|
||||
c->refcount++;
|
||||
}
|
||||
lws_set_timeout(w, NO_PENDING_TIMEOUT, 0);
|
||||
/*
|
||||
* This may decide to close / delete w
|
||||
*/
|
||||
if (w->adns_cb(w, (const char *)&q[1], c ? c->results : NULL, 0,
|
||||
q->opaque) == NULL)
|
||||
lwsl_notice("%s: failed\n", __func__);
|
||||
// lws_close_free_wsi(w, LWS_CLOSE_STATUS_NOSTATUS,
|
||||
// "adopt udp2 fail");
|
||||
|
||||
lws_set_timeout(w, NO_PENDING_TIMEOUT, 0);
|
||||
|
||||
} lws_end_foreach_dll_safe(d, d1);
|
||||
|
||||
if (q->standalone_cb) {
|
||||
|
@ -589,7 +593,8 @@ lws_async_dns_query(struct lws_context *context, int tsi, const char *name,
|
|||
m = c->results ? LADNS_RET_FOUND : LADNS_RET_FAILED;
|
||||
if (c->results)
|
||||
c->refcount++;
|
||||
cb(wsi, name, c->results, m, opaque);
|
||||
if (cb(wsi, name, c->results, m, opaque) == NULL)
|
||||
return LADNS_RET_FAILED_WSI_CLOSED;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue