Lines Matching refs:dns
46 lws_adns_get_query(lws_async_dns_t *dns, adns_query_type_t qtype, in lws_adns_get_query() argument
63 if (owner == &dns->cached) { in lws_adns_get_query()
66 lws_dll2_add_head(&q->list, &dns->cached); in lws_adns_get_query()
114 lwsl_wsi_debug(q->dns ? q->dns->wsi : NULL, "q: %p, c: %p, refcount %d -> %d", in lws_async_dns_complete()
123 lws_adns_dump(q->dns); in lws_async_dns_complete()
133 lwsl_wsi_info(q->dns ? q->dns->wsi : NULL, "in"); in lws_async_dns_sul_cb_retry()
134 lws_adns_dump(q->dns); in lws_async_dns_sul_cb_retry()
136 if (q->dns && q->dns->wsi) { in lws_async_dns_sul_cb_retry()
138 lws_callback_on_writable(q->dns->wsi); in lws_async_dns_sul_cb_retry()
289 struct lws_async_dns *dns = &(lws_get_context(wsi)->async_dns); in callback_async_dns() local
306 lws_adns_parse_udp(dns, in, len); in callback_async_dns()
312 dns->waiting.head) { in callback_async_dns()
336 lws_async_dns_t *dns = &context->async_dns; in lws_async_dns_init() local
340 if (dns->wsi) in lws_async_dns_init()
348 memset(&dns->sa46, 0, sizeof(dns->sa46)); in lws_async_dns_init()
351 if (lws_dhcpc_status(context, &dns->sa46)) in lws_async_dns_init()
355 n = lws_plat_asyncdns_init(context, &dns->sa46); in lws_async_dns_init()
368 dns->sa46.sa4.sin_port = htons(53); in lws_async_dns_init()
369 lws_write_numeric_address((uint8_t *)&dns->sa46.sa4.sin_addr.s_addr, 4, in lws_async_dns_init()
372 dns->wsi = lws_create_adopt_udp(context->vhost_list, ads, 53, 0, in lws_async_dns_init()
375 if (!dns->wsi) { in lws_async_dns_init()
380 context->async_dns.wsi->udp->sa46 = dns->sa46; in lws_async_dns_init()
382 dns->dns_server_set = 1; in lws_async_dns_init()
388 lws_adns_get_cache(lws_async_dns_t *dns, const char *name) in lws_adns_get_cache() argument
398 lws_dll2_get_head(&dns->cached)) { in lws_adns_get_cache()
406 lws_dll2_add_head(&c->list, &dns->cached); in lws_adns_get_cache()
417 lws_adns_dump(lws_async_dns_t *dns) in lws_adns_dump() argument
421 if (!dns) in lws_adns_dump()
424 lwsl_wsi_info(dns->wsi, "ADNS cache %u entries", in lws_adns_dump()
425 (unsigned int)dns->cached.count); in lws_adns_dump()
428 lws_dll2_get_head(&dns->cached)) { in lws_adns_dump()
431 lwsl_wsi_info(dns->wsi, "cache: '%s', exp: %lldus, incomp %d, " in lws_adns_dump()
438 lws_dll2_get_head(&dns->waiting)) { in lws_adns_dump()
441 lwsl_wsi_info(dns->wsi, "q: '%s', sent %d, resp %d", in lws_adns_dump()
485 lwsl_wsi_info(q->dns ? q->dns->wsi : NULL, "failing"); in sul_cb_write()
486 lws_adns_dump(q->dns); in sul_cb_write()
524 lws_async_dns_trim_cache(lws_async_dns_t *dns) in lws_async_dns_trim_cache() argument
528 if (dns->cached.count + 1< MAX_CACHE_ENTRIES) in lws_async_dns_trim_cache()
531 c1 = lws_container_of(lws_dll2_get_tail(&dns->cached), in lws_async_dns_trim_cache()
534 lwsl_wsi_info(dns->wsi, "acache %p: refcount %d on purge", in lws_async_dns_trim_cache()
550 lws_async_dns_deinit(lws_async_dns_t *dns) in lws_async_dns_deinit() argument
552 lws_dll2_foreach_safe(&dns->waiting, NULL, clean); in lws_async_dns_deinit()
553 lws_dll2_foreach_safe(&dns->cached, NULL, cache_clean); in lws_async_dns_deinit()
555 if (dns->wsi && !dns->dns_server_connected) { in lws_async_dns_deinit()
556 lwsl_wsi_notice(dns->wsi, "late free of incomplete dns wsi"); in lws_async_dns_deinit()
557 __lws_lc_untag(dns->wsi->a.context, &dns->wsi->lc); in lws_async_dns_deinit()
559 lws_metrics_tags_destroy(&dns->wsi->cal_conn.mtags_owner); in lws_async_dns_deinit()
561 lws_free_set_NULL(dns->wsi->udp); in lws_async_dns_deinit()
562 lws_free_set_NULL(dns->wsi); in lws_async_dns_deinit()
590 lws_async_dns_t *dns = &wsi->a.context->async_dns; in lws_async_dns_cancel() local
592 lws_dll2_foreach_safe(&dns->waiting, wsi, cancel); in lws_async_dns_cancel()
614 lws_async_dns_t *dns = &context->async_dns; in lws_async_dns_get_new_tid() local
626 if (lws_dll2_foreach_safe(&dns->waiting, in lws_async_dns_get_new_tid()
652 lws_async_dns_t *dns = &context->async_dns; in lws_async_dns_query() local
664 lws_adns_dump(dns); in lws_async_dns_query()
700 c = lws_adns_get_cache(dns, name); in lws_async_dns_query()
737 lws_async_dns_trim_cache(dns); in lws_async_dns_query()
763 lws_dll2_add_head(&c->list, &dns->cached); in lws_async_dns_query()
767 lws_adns_dump(dns); in lws_async_dns_query()
808 q = lws_adns_get_query(dns, qtype, &dns->waiting, 0, name); in lws_async_dns_query()
858 q->dns = dns; in lws_async_dns_query()
864 if (lws_retry_sul_schedule_retry_wsi(dns->wsi, &q->sul, in lws_async_dns_query()
885 lws_callback_on_writable(dns->wsi); in lws_async_dns_query()
887 lws_dll2_add_head(&q->list, &dns->waiting); in lws_async_dns_query()
894 lws_adns_dump(dns); in lws_async_dns_query()