Lines Matching full:mesh
2 * services/mesh.c - deal with mesh of query states and handle events for that.
39 * This file contains functions to assist in dealing with a mesh of
40 * query states. This mesh is supposed to be thread-specific.
46 #include "services/mesh.h"
81 * Compare two response-ip client info entries for the purpose of mesh state
85 * We cannot share the mesh state for two queries if different response-ip
193 struct mesh_area* mesh = calloc(1, sizeof(struct mesh_area)); in mesh_create() local
194 if(!mesh) { in mesh_create()
195 log_err("mesh area alloc: out of memory"); in mesh_create()
198 mesh->histogram = timehist_setup(); in mesh_create()
199 mesh->qbuf_bak = sldns_buffer_new(env->cfg->msg_buffer_size); in mesh_create()
200 if(!mesh->histogram || !mesh->qbuf_bak) { in mesh_create()
201 free(mesh); in mesh_create()
202 log_err("mesh area alloc: out of memory"); in mesh_create()
205 mesh->mods = *stack; in mesh_create()
206 mesh->env = env; in mesh_create()
207 rbtree_init(&mesh->run, &mesh_state_compare); in mesh_create()
208 rbtree_init(&mesh->all, &mesh_state_compare); in mesh_create()
209 mesh->num_reply_addrs = 0; in mesh_create()
210 mesh->num_reply_states = 0; in mesh_create()
211 mesh->num_detached_states = 0; in mesh_create()
212 mesh->num_forever_states = 0; in mesh_create()
213 mesh->stats_jostled = 0; in mesh_create()
214 mesh->stats_dropped = 0; in mesh_create()
215 mesh->ans_expired = 0; in mesh_create()
216 mesh->ans_cachedb = 0; in mesh_create()
217 mesh->max_reply_states = env->cfg->num_queries_per_thread; in mesh_create()
218 mesh->max_forever_states = (mesh->max_reply_states+1)/2; in mesh_create()
220 mesh->jostle_max.tv_sec = (time_t)(env->cfg->jostle_time / 1000); in mesh_create()
221 mesh->jostle_max.tv_usec = (time_t)((env->cfg->jostle_time % 1000) in mesh_create()
224 return mesh; in mesh_create()
227 /** help mesh delete delete mesh states */
233 * because other callbacks expect a clean state in the mesh. in mesh_delete_helper()
241 mesh_delete(struct mesh_area* mesh) in mesh_delete() argument
243 if(!mesh) in mesh_delete()
246 while(mesh->all.count) in mesh_delete()
247 mesh_delete_helper(mesh->all.root); in mesh_delete()
248 timehist_delete(mesh->histogram); in mesh_delete()
249 sldns_buffer_free(mesh->qbuf_bak); in mesh_delete()
250 free(mesh); in mesh_delete()
254 mesh_delete_all(struct mesh_area* mesh) in mesh_delete_all() argument
257 while(mesh->all.count) in mesh_delete_all()
258 mesh_delete_helper(mesh->all.root); in mesh_delete_all()
259 mesh->stats_dropped += mesh->num_reply_addrs; in mesh_delete_all()
260 /* clear mesh area references */ in mesh_delete_all()
261 rbtree_init(&mesh->run, &mesh_state_compare); in mesh_delete_all()
262 rbtree_init(&mesh->all, &mesh_state_compare); in mesh_delete_all()
263 mesh->num_reply_addrs = 0; in mesh_delete_all()
264 mesh->num_reply_states = 0; in mesh_delete_all()
265 mesh->num_detached_states = 0; in mesh_delete_all()
266 mesh->num_forever_states = 0; in mesh_delete_all()
267 mesh->forever_first = NULL; in mesh_delete_all()
268 mesh->forever_last = NULL; in mesh_delete_all()
269 mesh->jostle_first = NULL; in mesh_delete_all()
270 mesh->jostle_last = NULL; in mesh_delete_all()
273 int mesh_make_new_space(struct mesh_area* mesh, sldns_buffer* qbuf) in mesh_make_new_space() argument
275 struct mesh_state* m = mesh->jostle_first; in mesh_make_new_space()
277 if(mesh->num_reply_states < mesh->max_reply_states) in mesh_make_new_space()
283 timeval_subtract(&age, mesh->env->now_tv, in mesh_make_new_space()
285 if(timeval_smaller(&mesh->jostle_max, &age)) { in mesh_make_new_space()
292 if(qbuf) sldns_buffer_copy(mesh->qbuf_bak, qbuf); in mesh_make_new_space()
298 mesh_walk_supers(mesh, m); in mesh_make_new_space()
300 mesh->stats_jostled ++; in mesh_make_new_space()
304 if(qbuf) sldns_buffer_copy(qbuf, mesh->qbuf_bak); in mesh_make_new_space()
405 void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo, in mesh_new_client() argument
411 int unique = unique_mesh_state(edns->opt_list_in, mesh->env); in mesh_new_client()
415 int timeout = mesh->env->cfg->serve_expired? in mesh_new_client()
416 mesh->env->cfg->serve_expired_client_timeout:0; in mesh_new_client()
422 if(!infra_wait_limit_allowed(mesh->env->infra_cache, rep, in mesh_new_client()
423 edns->cookie_valid, mesh->env->cfg)) { in mesh_new_client()
427 mesh->stats_dropped++; in mesh_new_client()
431 s = mesh_area_find(mesh, cinfo, qinfo, mesh_flags, 0, 0); in mesh_new_client()
434 if(!mesh_make_new_space(mesh, rep->c->buffer)) { in mesh_new_client()
438 mesh->stats_dropped++; in mesh_new_client()
445 if(mesh->num_reply_addrs > mesh->max_reply_states*16) { in mesh_new_client()
449 mesh->stats_dropped++; in mesh_new_client()
458 s = mesh_state_create(mesh->env, qinfo, cinfo, in mesh_new_client()
462 if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL, NULL, in mesh_new_client()
463 LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv)) in mesh_new_client()
471 mesh->num_detached_states++; in mesh_new_client()
481 if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL, in mesh_new_client()
482 NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv)) in mesh_new_client()
497 rbtree_insert(&mesh->all, &s->node); in mesh_new_client()
513 if(!tcp_req_info_add_meshstate(rep->c->tcp_req_info, mesh, s)) { in mesh_new_client()
519 http2_stream_add_meshstate(rep->c->h2_stream, mesh, s); in mesh_new_client()
527 if(!timeout && mesh->env->cfg->serve_expired && in mesh_new_client()
528 !mesh->env->cfg->serve_expired_client_timeout && in mesh_new_client()
529 (mesh->env->cachedb_enabled && in mesh_new_client()
530 mesh->env->cfg->cachedb_check_when_serve_expired)) { in mesh_new_client()
537 infra_wait_limit_inc(mesh->env->infra_cache, rep, *mesh->env->now, in mesh_new_client()
538 mesh->env->cfg); in mesh_new_client()
541 log_assert(mesh->num_detached_states > 0); in mesh_new_client()
542 mesh->num_detached_states--; in mesh_new_client()
545 mesh->num_reply_states ++; in mesh_new_client()
547 mesh->num_reply_addrs++; in mesh_new_client()
550 if(mesh->num_forever_states < mesh->max_forever_states) { in mesh_new_client()
551 mesh->num_forever_states ++; in mesh_new_client()
552 mesh_list_insert(s, &mesh->forever_first, in mesh_new_client()
553 &mesh->forever_last); in mesh_new_client()
556 mesh_list_insert(s, &mesh->jostle_first, in mesh_new_client()
557 &mesh->jostle_last); in mesh_new_client()
562 mesh_run(mesh, s, module_event_new, NULL); in mesh_new_client()
566 if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, &s->s, in mesh_new_client()
567 NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv)) in mesh_new_client()
580 mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo, in mesh_new_callback() argument
585 int unique = unique_mesh_state(edns->opt_list_in, mesh->env); in mesh_new_callback()
586 int timeout = mesh->env->cfg->serve_expired? in mesh_new_callback()
587 mesh->env->cfg->serve_expired_client_timeout:0; in mesh_new_callback()
593 s = mesh_area_find(mesh, NULL, qinfo, mesh_flags, 0, 0); in mesh_new_callback()
602 s = mesh_state_create(mesh->env, qinfo, NULL, in mesh_new_callback()
608 mesh->num_detached_states++; in mesh_new_callback()
625 rbtree_insert(&mesh->all, &s->node); in mesh_new_callback()
648 if(!timeout && mesh->env->cfg->serve_expired && in mesh_new_callback()
649 !mesh->env->cfg->serve_expired_client_timeout && in mesh_new_callback()
650 (mesh->env->cachedb_enabled && in mesh_new_callback()
651 mesh->env->cfg->cachedb_check_when_serve_expired)) { in mesh_new_callback()
661 log_assert(mesh->num_detached_states > 0); in mesh_new_callback()
662 mesh->num_detached_states--; in mesh_new_callback()
665 mesh->num_reply_states ++; in mesh_new_callback()
667 mesh->num_reply_addrs++; in mesh_new_callback()
669 mesh_run(mesh, s, module_event_new, NULL); in mesh_new_callback()
678 static void mesh_schedule_prefetch(struct mesh_area* mesh, in mesh_schedule_prefetch() argument
686 struct mesh_state* s = mesh_area_find(mesh, NULL, qinfo, in mesh_schedule_prefetch()
701 if(!mesh_make_new_space(mesh, NULL)) { in mesh_schedule_prefetch()
703 mesh->stats_dropped ++; in mesh_schedule_prefetch()
707 s = mesh_state_create(mesh->env, qinfo, NULL, mesh_flags, 0, 0); in mesh_schedule_prefetch()
717 rbtree_insert(&mesh->all, &s->node); in mesh_schedule_prefetch()
720 mesh->num_detached_states++; in mesh_schedule_prefetch()
727 if(mesh->num_forever_states < mesh->max_forever_states) { in mesh_schedule_prefetch()
728 mesh->num_forever_states ++; in mesh_schedule_prefetch()
729 mesh_list_insert(s, &mesh->forever_first, in mesh_schedule_prefetch()
730 &mesh->forever_last); in mesh_schedule_prefetch()
733 mesh_list_insert(s, &mesh->jostle_first, in mesh_schedule_prefetch()
734 &mesh->jostle_last); in mesh_schedule_prefetch()
746 rbtree_insert(&mesh->run, &s->run_node); in mesh_schedule_prefetch()
751 mesh_run(mesh, s, module_event_new, NULL); in mesh_schedule_prefetch()
759 static void mesh_schedule_prefetch_subnet(struct mesh_area* mesh, in mesh_schedule_prefetch_subnet() argument
772 if(!mesh_make_new_space(mesh, NULL)) { in mesh_schedule_prefetch_subnet()
774 mesh->stats_dropped ++; in mesh_schedule_prefetch_subnet()
778 s = mesh_state_create(mesh->env, qinfo, NULL, mesh_flags, 0, 0); in mesh_schedule_prefetch_subnet()
785 opt = edns_opt_list_find(edns_list, mesh->env->cfg->client_subnet_opcode); in mesh_schedule_prefetch_subnet()
804 rbtree_insert(&mesh->all, &s->node); in mesh_schedule_prefetch_subnet()
807 mesh->num_detached_states++; in mesh_schedule_prefetch_subnet()
814 if(mesh->num_forever_states < mesh->max_forever_states) { in mesh_schedule_prefetch_subnet()
815 mesh->num_forever_states ++; in mesh_schedule_prefetch_subnet()
816 mesh_list_insert(s, &mesh->forever_first, in mesh_schedule_prefetch_subnet()
817 &mesh->forever_last); in mesh_schedule_prefetch_subnet()
820 mesh_list_insert(s, &mesh->jostle_first, in mesh_schedule_prefetch_subnet()
821 &mesh->jostle_last); in mesh_schedule_prefetch_subnet()
833 rbtree_insert(&mesh->run, &s->run_node); in mesh_schedule_prefetch_subnet()
838 mesh_run(mesh, s, module_event_new, NULL); in mesh_schedule_prefetch_subnet()
842 void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo, in mesh_new_prefetch() argument
850 mesh_schedule_prefetch_subnet(mesh, qinfo, qflags, leeway, 1, in mesh_new_prefetch()
854 mesh_schedule_prefetch(mesh, qinfo, qflags, leeway, 1, in mesh_new_prefetch()
858 void mesh_report_reply(struct mesh_area* mesh, struct outbound_entry* e, in mesh_report_reply() argument
868 mesh_run(mesh, e->qstate->mesh_info, event, e); in mesh_report_reply()
938 for(i=0; i<env->mesh->mods.num; i++) { in mesh_state_create()
960 struct mesh_area* mesh; in mesh_state_cleanup() local
964 mesh = mstate->s.env->mesh; in mesh_state_cleanup()
976 * takes no time and also it does not do the mesh accounting */ in mesh_state_cleanup()
979 infra_wait_limit_dec(mesh->env->infra_cache, in mesh_state_cleanup()
980 &rep->query_reply, mesh->env->cfg); in mesh_state_cleanup()
984 log_assert(mesh->num_reply_addrs > 0); in mesh_state_cleanup()
985 mesh->num_reply_addrs--; in mesh_state_cleanup()
992 log_assert(mesh->num_reply_addrs > 0); in mesh_state_cleanup()
993 mesh->num_reply_addrs--; in mesh_state_cleanup()
998 for(i=0; i<mesh->mods.num; i++) { in mesh_state_cleanup()
999 fptr_ok(fptr_whitelist_mod_clear(mesh->mods.mod[i]->clear)); in mesh_state_cleanup()
1000 (*mesh->mods.mod[i]->clear)(&mstate->s, i); in mesh_state_cleanup()
1010 struct mesh_area* mesh; in mesh_state_delete() local
1016 mesh = mstate->s.env->mesh; in mesh_state_delete()
1019 mesh->num_forever_states --; in mesh_state_delete()
1020 mesh_list_remove(mstate, &mesh->forever_first, in mesh_state_delete()
1021 &mesh->forever_last); in mesh_state_delete()
1023 mesh_list_remove(mstate, &mesh->jostle_first, in mesh_state_delete()
1024 &mesh->jostle_last); in mesh_state_delete()
1028 log_assert(mesh->num_detached_states > 0); in mesh_state_delete()
1029 mesh->num_detached_states--; in mesh_state_delete()
1032 log_assert(mesh->num_reply_states > 0); in mesh_state_delete()
1033 mesh->num_reply_states--; in mesh_state_delete()
1040 (void)rbtree_delete(&mesh->run, mstate); in mesh_state_delete()
1041 (void)rbtree_delete(&mesh->all, mstate); in mesh_state_delete()
1077 struct mesh_area* mesh = qstate->env->mesh; in mesh_detach_subs() local
1094 mesh->num_detached_states++; in mesh_detach_subs()
1095 log_assert(mesh->num_detached_states + in mesh_detach_subs()
1096 mesh->num_reply_states <= mesh->all.count); in mesh_detach_subs()
1107 struct mesh_area* mesh = qstate->env->mesh; in mesh_add_sub() local
1108 *sub = mesh_area_find(mesh, NULL, qinfo, qflags, in mesh_add_sub()
1130 rbtree_insert(&mesh->all, &(*sub)->node); in mesh_add_sub()
1133 mesh->num_detached_states++; in mesh_add_sub()
1140 rbtree_insert(&mesh->run, &(*sub)->run_node); in mesh_add_sub()
1151 struct mesh_area* mesh = qstate->env->mesh; in mesh_attach_sub() local
1163 log_assert(mesh->num_detached_states > 0); in mesh_attach_sub()
1164 mesh->num_detached_states--; in mesh_attach_sub()
1208 * callback results to mesh cb entry
1209 * @param m: mesh state to send it for.
1214 * a value from one of the packets if the mesh state had packets.
1277 log_assert(m->s.env->mesh->num_reply_addrs > 0); in mesh_do_callback()
1278 m->s.env->mesh->num_reply_addrs--; in mesh_do_callback()
1325 * Send reply to mesh reply entry
1326 * @param m: mesh state to send it for.
1345 * null stops the mesh state remove and thus in mesh_send_reply()
1360 m->s.env->mesh->ans_bogus++; in mesh_send_reply()
1369 /* Mesh reply won't exist for long anymore. Make it impossible in mesh_send_reply()
1370 * for HTTP/2 stream to refer to mesh state, in case in mesh_send_reply()
1469 log_assert(m->s.env->mesh->num_reply_addrs > 0); in mesh_send_reply()
1470 m->s.env->mesh->num_reply_addrs--; in mesh_send_reply()
1475 m->s.env->mesh->replies_sent++; in mesh_send_reply()
1476 timeval_add(&m->s.env->mesh->replies_sum_wait, &duration); in mesh_send_reply()
1477 timehist_insert(m->s.env->mesh->histogram, &duration); in mesh_send_reply()
1481 if(secure) m->s.env->mesh->ans_secure++; in mesh_send_reply()
1482 m->s.env->mesh->ans_rcode[ rc ] ++; in mesh_send_reply()
1484 m->s.env->mesh->ans_nodata++; in mesh_send_reply()
1530 * tcp req info cleanup routine that calls the mesh in mesh_query_done()
1543 mstate->s.env->mesh->stats_dropped++; in mesh_query_done()
1562 * mesh processing, this is the point to take that action. */ in mesh_query_done()
1565 * tcp req info cleanup routine that calls the mesh in mesh_query_done()
1590 /* mesh_send_reply removed mesh state from in mesh_query_done()
1602 mstate->s.env->mesh->rpz_action[RPZ_DISABLED_ACTION] += i; in mesh_query_done()
1604 mstate->s.env->mesh->rpz_action[RPZ_CNAME_OVERRIDE_ACTION] += i; in mesh_query_done()
1606 mstate->s.env->mesh->rpz_action[respip_action_to_rpz_action( in mesh_query_done()
1612 mstate->s.env->mesh->ans_cachedb += i; in mesh_query_done()
1616 /* Mesh area accounting */ in mesh_query_done()
1621 log_assert(mstate->s.env->mesh->num_reply_states > 0); in mesh_query_done()
1622 mstate->s.env->mesh->num_reply_states--; in mesh_query_done()
1626 mstate->s.env->mesh->num_detached_states++; in mesh_query_done()
1635 log_assert(mstate->s.env->mesh->num_reply_states > 0); in mesh_query_done()
1636 mstate->s.env->mesh->num_reply_states--; in mesh_query_done()
1641 mstate->s.env->mesh->num_detached_states++; in mesh_query_done()
1646 void mesh_walk_supers(struct mesh_area* mesh, struct mesh_state* mstate) in mesh_walk_supers() argument
1652 (void)rbtree_insert(&mesh->run, &ref->s->run_node); in mesh_walk_supers()
1655 mesh->mods.mod[ref->s->s.curmod]->inform_super)); in mesh_walk_supers()
1656 (*mesh->mods.mod[ref->s->s.curmod]->inform_super)(&mstate->s, in mesh_walk_supers()
1663 struct mesh_state* mesh_area_find(struct mesh_area* mesh, in mesh_area_find() argument
1675 /* We are searching for a similar mesh state when we DO want to in mesh_area_find()
1681 result = (struct mesh_state*)rbtree_search(&mesh->all, &key); in mesh_area_find()
1817 * Continue processing the mesh state at another module.
1820 * @param mesh: the mesh area.
1821 * @param mstate: currently active mesh state.
1823 * send replies to clients and inform other mesh states.
1824 * This in turn may create additional runnable mesh states.
1832 mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate, in mesh_continue() argument
1839 mesh->mods.mod[mstate->s.curmod]->name); in mesh_continue()
1847 if(mesh->mods.num == mstate->s.curmod) { in mesh_continue()
1852 return mesh_continue(mesh, mstate, module_error, ev); in mesh_continue()
1856 for(; mstate->s.curmod < mesh->mods.num; in mesh_continue()
1859 mesh->mods.mod[mstate->s.curmod]->clear)); in mesh_continue()
1860 (*mesh->mods.mod[mstate->s.curmod]->clear) in mesh_continue()
1881 mesh_walk_supers(mesh, mstate); in mesh_continue()
1896 modstack_find(&mesh->mods, "subnetcache") != -1 && in mesh_continue()
1904 mesh_walk_supers(mesh, mstate); in mesh_continue()
1928 mesh_new_prefetch(mesh, qinfo, qflags, 0, in mesh_continue()
1945 void mesh_run(struct mesh_area* mesh, struct mesh_state* mstate, in mesh_run() argument
1953 mesh->mods.mod[mstate->s.curmod]->operate)); in mesh_run()
1954 (*mesh->mods.mod[mstate->s.curmod]->operate) in mesh_run()
1962 mesh->mods.mod[mstate->s.curmod]->name, strextstate(s)); in mesh_run()
1964 if(mesh_continue(mesh, mstate, s, &ev)) in mesh_run()
1969 if(mesh->run.count > 0) { in mesh_run()
1971 mstate = (struct mesh_state*)mesh->run.root->key; in mesh_run()
1972 (void)rbtree_delete(&mesh->run, mstate); in mesh_run()
1976 mesh_stats(mesh, "mesh_run: end"); in mesh_run()
1977 mesh_log_list(mesh); in mesh_run()
1982 mesh_log_list(struct mesh_area* mesh) in mesh_log_list() argument
1987 RBTREE_FOR(m, struct mesh_state*, &mesh->all) { in mesh_log_list()
2003 mesh_stats(struct mesh_area* mesh, const char* str) in mesh_stats() argument
2008 str, (unsigned)mesh->all.count, in mesh_stats()
2009 (unsigned)mesh->num_reply_states, in mesh_stats()
2010 (unsigned)mesh->num_detached_states, in mesh_stats()
2011 (unsigned)mesh->num_reply_addrs, in mesh_stats()
2012 (unsigned)mesh->replies_sent, in mesh_stats()
2013 (unsigned)mesh->stats_dropped, in mesh_stats()
2014 (unsigned)mesh->stats_jostled); in mesh_stats()
2015 if(mesh->replies_sent > 0) { in mesh_stats()
2017 timeval_divide(&avg, &mesh->replies_sum_wait, in mesh_stats()
2018 mesh->replies_sent); in mesh_stats()
2023 timehist_log(mesh->histogram, "recursions"); in mesh_stats()
2028 mesh_stats_clear(struct mesh_area* mesh) in mesh_stats_clear() argument
2030 if(!mesh) in mesh_stats_clear()
2032 mesh->replies_sent = 0; in mesh_stats_clear()
2033 mesh->replies_sum_wait.tv_sec = 0; in mesh_stats_clear()
2034 mesh->replies_sum_wait.tv_usec = 0; in mesh_stats_clear()
2035 mesh->stats_jostled = 0; in mesh_stats_clear()
2036 mesh->stats_dropped = 0; in mesh_stats_clear()
2037 timehist_clear(mesh->histogram); in mesh_stats_clear()
2038 mesh->ans_secure = 0; in mesh_stats_clear()
2039 mesh->ans_bogus = 0; in mesh_stats_clear()
2040 mesh->ans_expired = 0; in mesh_stats_clear()
2041 mesh->ans_cachedb = 0; in mesh_stats_clear()
2042 memset(&mesh->ans_rcode[0], 0, sizeof(size_t)*UB_STATS_RCODE_NUM); in mesh_stats_clear()
2043 memset(&mesh->rpz_action[0], 0, sizeof(size_t)*UB_STATS_RPZ_ACTION_NUM); in mesh_stats_clear()
2044 mesh->ans_nodata = 0; in mesh_stats_clear()
2048 mesh_get_mem(struct mesh_area* mesh) in mesh_get_mem() argument
2051 size_t s = sizeof(*mesh) + sizeof(struct timehist) + in mesh_get_mem()
2052 sizeof(struct th_buck)*mesh->histogram->num + in mesh_get_mem()
2053 sizeof(sldns_buffer) + sldns_buffer_capacity(mesh->qbuf_bak); in mesh_get_mem()
2054 RBTREE_FOR(m, struct mesh_state*, &mesh->all) { in mesh_get_mem()
2065 struct mesh_area* mesh = qstate->env->mesh; in mesh_detect_cycle() local
2067 dep_m = mesh_area_find(mesh, NULL, qinfo, flags, prime, valrec); in mesh_detect_cycle()
2094 void mesh_state_remove_reply(struct mesh_area* mesh, struct mesh_state* m, in mesh_state_remove_reply() argument
2108 log_assert(mesh->num_reply_addrs > 0); in mesh_state_remove_reply()
2109 mesh->num_reply_addrs--; in mesh_state_remove_reply()
2110 infra_wait_limit_dec(mesh->env->infra_cache, in mesh_state_remove_reply()
2111 &n->query_reply, mesh->env->cfg); in mesh_state_remove_reply()
2123 mesh->num_detached_states++; in mesh_state_remove_reply()
2127 log_assert(mesh->num_reply_states > 0); in mesh_state_remove_reply()
2128 mesh->num_reply_states--; in mesh_state_remove_reply()
2165 struct mesh_area* mesh = qstate->env->mesh; in mesh_serve_expired_callback() local
2207 if((mesh->use_response_ip || mesh->use_rpz) && in mesh_serve_expired_callback()
2260 * tcp req info cleanup routine that calls the mesh in mesh_serve_expired_callback()
2273 mstate->s.env->mesh->stats_dropped++; in mesh_serve_expired_callback()
2306 /* mesh_send_reply removed mesh state from http2_stream. */ in mesh_serve_expired_callback()
2314 mesh->ans_expired += i; in mesh_serve_expired_callback()
2318 qstate->env->mesh->rpz_action[RPZ_DISABLED_ACTION] += i; in mesh_serve_expired_callback()
2320 qstate->env->mesh->rpz_action[RPZ_CNAME_OVERRIDE_ACTION] += i; in mesh_serve_expired_callback()
2322 qstate->env->mesh->rpz_action[ in mesh_serve_expired_callback()
2327 /* Mesh area accounting */ in mesh_serve_expired_callback()
2331 log_assert(mesh->num_reply_states > 0); in mesh_serve_expired_callback()
2332 mesh->num_reply_states--; in mesh_serve_expired_callback()
2334 mesh->num_detached_states++; in mesh_serve_expired_callback()
2344 log_assert(qstate->env->mesh->num_reply_states > 0); in mesh_serve_expired_callback()
2345 qstate->env->mesh->num_reply_states--; in mesh_serve_expired_callback()
2350 qstate->env->mesh->num_detached_states++; in mesh_serve_expired_callback()
2363 int mesh_jostle_exceeded(struct mesh_area* mesh) in mesh_jostle_exceeded() argument
2365 if(mesh->all.count < mesh->max_reply_states) in mesh_jostle_exceeded()