diff --git a/lib/core-net/client/sort-dns.c b/lib/core-net/client/sort-dns.c index 4f9fdc572..406e9f317 100644 --- a/lib/core-net/client/sort-dns.c +++ b/lib/core-net/client/sort-dns.c @@ -653,7 +653,7 @@ lws_sort_dns(struct lws *wsi, const struct addrinfo *result) estr = _lws_route_est_outgoing(pt, &ds->dest); if (!estr) { lws_free(ds); - lwsl_notice("%s: no route out\n", __func__); + lwsl_info("%s: no route out\n", __func__); /* * There's no outbound route for this, it's * unusable, so don't add it to the list diff --git a/lib/core-net/vhost.c b/lib/core-net/vhost.c index 42be7bb91..8b8336ea6 100644 --- a/lib/core-net/vhost.c +++ b/lib/core-net/vhost.c @@ -1424,7 +1424,7 @@ lws_vhost_destroy(struct lws_vhost *vh) /* start async closure of all wsi on this pt thread attached to vh */ __lws_vhost_destroy_pt_wsi_dieback_start(vh); - lwsl_notice("%s: count_bound_wsi %d\n", __func__, vh->count_bound_wsi); + lwsl_info("%s: count_bound_wsi %d\n", __func__, vh->count_bound_wsi); /* if there are none, finalize now since no further chance */ if (!vh->count_bound_wsi) { diff --git a/lib/system/async-dns/async-dns-parse.c b/lib/system/async-dns/async-dns-parse.c index 24db2c647..6af640818 100644 --- a/lib/system/async-dns/async-dns-parse.c +++ b/lib/system/async-dns/async-dns-parse.c @@ -554,7 +554,7 @@ lws_adns_parse_udp(lws_async_dns_t *dns, const uint8_t *pkt, size_t len) q = lws_adns_get_query(dns, 0, &dns->waiting, lws_ser_ru16be(pkt + DHO_TID), NULL); if (!q) { - lwsl_notice("%s: dropping unknown query tid 0x%x\n", + lwsl_info("%s: dropping unknown query tid 0x%x\n", __func__, lws_ser_ru16be(pkt + DHO_TID)); return; diff --git a/lib/system/async-dns/async-dns.c b/lib/system/async-dns/async-dns.c index a1e0f70e5..f91e4897d 100644 --- a/lib/system/async-dns/async-dns.c +++ b/lib/system/async-dns/async-dns.c @@ -136,8 +136,6 @@ lws_async_dns_writeable(struct lws *wsi, lws_adns_q_t *q) int m, n, which; const char *name; - lwsl_notice("%s: %p\n", __func__, q); - /* * We managed to get to the point of being WRITEABLE, which is not a * given if no routes. So call off the write_sul timeout for that. @@ -160,7 +158,7 @@ lws_async_dns_writeable(struct lws *wsi, lws_adns_q_t *q) lws_retry_sul_schedule_retry_wsi(wsi, &q->sul, lws_async_dns_sul_cb_retry, &q->retry)) { /* we have reached the end of our concealed retries */ - lwsl_notice("%s: failing query\n", __func__); + lwsl_info("%s: failing query\n", __func__); /* * our policy is to force reloading the dns server info * if our connection ever timed out, in case it or the @@ -256,7 +254,7 @@ qfail: * incomplete cache entry */ if (q->firstcache) { - lwsl_notice("%s: destroy firstcache\n", __func__); + lwsl_debug("%s: destroy firstcache\n", __func__); lws_adns_cache_destroy(q->firstcache); q->firstcache = NULL; } @@ -275,21 +273,21 @@ callback_async_dns(struct lws *wsi, enum lws_callback_reasons reason, /* callbacks related to raw socket descriptor */ case LWS_CALLBACK_RAW_ADOPT: - lwsl_user("LWS_CALLBACK_RAW_ADOPT\n"); + //lwsl_user("LWS_CALLBACK_RAW_ADOPT\n"); break; case LWS_CALLBACK_RAW_CLOSE: - lwsl_user("LWS_CALLBACK_RAW_CLOSE\n"); + //lwsl_user("LWS_CALLBACK_RAW_CLOSE\n"); break; case LWS_CALLBACK_RAW_RX: - lwsl_user("LWS_CALLBACK_RAW_RX (%d)\n", (int)len); + //lwsl_user("LWS_CALLBACK_RAW_RX (%d)\n", (int)len); // lwsl_hexdump_level(LLL_NOTICE, in, len); lws_adns_parse_udp(dns, in, len); break; case LWS_CALLBACK_RAW_WRITEABLE: - lwsl_user("LWS_CALLBACK_RAW_WRITEABLE\n"); + //lwsl_user("LWS_CALLBACK_RAW_WRITEABLE\n"); lws_start_foreach_dll_safe(struct lws_dll2 *, d, d1, dns->waiting.head) { lws_adns_q_t *q = lws_container_of(d, lws_adns_q_t, @@ -510,7 +508,7 @@ lws_async_dns_trim_cache(lws_async_dns_t *dns) c1 = lws_container_of(lws_dll2_get_tail(&dns->cached), lws_adns_cache_t, list); if (c1->refcount) - lwsl_notice("%s: acache %p: refcount %d on purge\n", + lwsl_info("%s: acache %p: refcount %d on purge\n", __func__, c1, c1->refcount); else lws_adns_cache_destroy(c1); @@ -660,16 +658,18 @@ lws_async_dns_query(struct lws_context *context, int tsi, const char *name, c = lws_adns_get_cache(dns, name); if (c) { - lwsl_info("%s: %s: using cached, c->results %p\n", __func__, name, c->results); + lwsl_info("%s: %s: using cached, c->results %p\n", __func__, + name, c->results); m = c->results ? LADNS_RET_FOUND : LADNS_RET_FAILED; if (c->results) c->refcount++; + if (cb(wsi, name, c->results, m, opaque) == NULL) return LADNS_RET_FAILED_WSI_CLOSED; return m; } else - lwsl_notice("%s: %s uncached\n", __func__, name); + lwsl_info("%s: %s uncached\n", __func__, name); /* * It's a 1.2.3.4 or ::1 type IP address already? We don't need a dns @@ -843,7 +843,8 @@ lws_async_dns_query(struct lws_context *context, int tsi, const char *name, failed: lwsl_notice("%s: failed\n", __func__); - cb(wsi, NULL, NULL, LADNS_RET_FAILED, opaque); + if (!cb(wsi, NULL, NULL, LADNS_RET_FAILED, opaque)) + return LADNS_RET_FAILED_WSI_CLOSED; return LADNS_RET_FAILED; } diff --git a/minimal-examples/api-tests/api-test-async-dns/main.c b/minimal-examples/api-tests/api-test-async-dns/main.c index 0a7203874..ae0f5e0c7 100644 --- a/minimal-examples/api-tests/api-test-async-dns/main.c +++ b/minimal-examples/api-tests/api-test-async-dns/main.c @@ -88,10 +88,10 @@ static const struct async_dns_tests { #if defined(LWS_WITH_IPV6) { "warmcat.com", LWS_ADNS_RECORD_AAAA, 16, /* check ipv6 */ { 0x20, 0x01, 0x41, 0xd0, 0x00, 0x02, 0xee, 0x93, - 0, 0, 0, 0, 0, 0, 0, 0, } }, + 0, 0, 0, 0, 0, 0, 0, 1, } }, { "ipv6only.warmcat.com", LWS_ADNS_RECORD_AAAA, 16, /* check ipv6 */ { 0x20, 0x01, 0x41, 0xd0, 0x00, 0x02, 0xee, 0x93, - 0, 0, 0, 0, 0, 0, 0, 0, } }, + 0, 0, 0, 0, 0, 0, 0, 1, } }, #endif };