They probably couldn't hang open for long, as each client request
should cause some cache-searching and thus close it, and even with
queries stopping I haven't managed to find a case where it would be
left open but... it's nicer to clean up and it should be very cheap.
/**
* @internal Fetch per-address information from various sources.
+ *
+ * Note that this opens a RO cache transaction; the callee is responsible
+ * for its closing not too long afterwards (e.g. calling kr_cache_commit).
*/
void update_address_state(struct address_state *state, union inaddr *address,
size_t address_len, struct kr_query *qry);
default:
kr_assert(false);
*transport = NULL;
- return;
+ goto cleanup;
}
struct address_state *addr_state = &local_state->addr_states[i];
qry->flags.TCP = (*transport)->protocol == KR_TRANSPORT_TCP
|| (*transport)->protocol == KR_TRANSPORT_TLS;
}
+cleanup:
+ kr_cache_commit(&qry->request->ctx->cache);
}
void forward_error(struct kr_query *qry, const struct kr_transport *transport,
}
}
trie_it_free(it);
+ kr_cache_commit(&qry->request->ctx->cache);
}
static int get_valid_addresses(struct iter_local_state *local_state,