Lines Matching defs:requestmgr
82 dns_requestmgr_t *requestmgr;
135 dns_requestmgr_t *requestmgr = isc_mem_get(mctx, sizeof(*requestmgr));
136 *requestmgr = (dns_requestmgr_t){
140 isc_mem_attach(mctx, &requestmgr->mctx);
142 uint32_t nloops = isc_loopmgr_nloops(requestmgr->loopmgr);
143 requestmgr->requests = isc_mem_cget(requestmgr->mctx, nloops,
144 sizeof(requestmgr->requests[0]));
146 ISC_LIST_INIT(requestmgr->requests[i]);
149 isc_loop_ref(isc_loop_get(requestmgr->loopmgr, i));
152 dns_dispatchmgr_attach(dispatchmgr, &requestmgr->dispatchmgr);
155 dns_dispatchset_create(requestmgr->mctx, dispatchv4,
156 &requestmgr->dispatches4,
157 isc_loopmgr_nloops(requestmgr->loopmgr));
160 dns_dispatchset_create(requestmgr->mctx, dispatchv6,
161 &requestmgr->dispatches6,
162 isc_loopmgr_nloops(requestmgr->loopmgr));
165 isc_refcount_init(&requestmgr->references, 1);
167 req_log(ISC_LOG_DEBUG(3), "%s: %p", __func__, requestmgr);
169 *requestmgrp = requestmgr;
175 dns_requestmgr_t *requestmgr = arg;
179 ISC_LIST_FOREACH_SAFE (requestmgr->requests[tid], request, link, next) {
189 isc_loop_unref(isc_loop_get(requestmgr->loopmgr, tid));
190 dns_requestmgr_detach(&requestmgr);
194 dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr) {
196 REQUIRE(VALID_REQUESTMGR(requestmgr));
198 req_log(ISC_LOG_DEBUG(3), "%s: %p", __func__, requestmgr);
201 first = atomic_compare_exchange_strong(&requestmgr->shuttingdown,
216 uint32_t nloops = isc_loopmgr_nloops(requestmgr->loopmgr);
218 dns_requestmgr_ref(requestmgr);
222 requests_shutdown(requestmgr);
226 isc_loop_t *loop = isc_loop_get(requestmgr->loopmgr, i);
227 isc_async_run(loop, requests_shutdown, requestmgr);
232 requestmgr_destroy(dns_requestmgr_t *requestmgr) {
235 INSIST(atomic_load(&requestmgr->shuttingdown));
237 size_t nloops = isc_loopmgr_nloops(requestmgr->loopmgr);
239 INSIST(ISC_LIST_EMPTY(requestmgr->requests[i]));
241 isc_mem_cput(requestmgr->mctx, requestmgr->requests, nloops,
242 sizeof(requestmgr->requests[0]));
244 if (requestmgr->dispatches4 != NULL) {
245 dns_dispatchset_destroy(&requestmgr->dispatches4);
247 if (requestmgr->dispatches6 != NULL) {
248 dns_dispatchset_destroy(&requestmgr->dispatches6);
250 if (requestmgr->dispatchmgr != NULL) {
251 dns_dispatchmgr_detach(&requestmgr->dispatchmgr);
253 requestmgr->magic = 0;
254 isc_mem_putanddetach(&requestmgr->mctx, requestmgr,
255 sizeof(*requestmgr));
341 tcp_dispatch(bool newtcp, dns_requestmgr_t *requestmgr,
347 result = dns_dispatch_gettcp(requestmgr->dispatchmgr, destaddr,
359 result = dns_dispatch_createtcp(requestmgr->dispatchmgr, srcaddr,
365 udp_dispatch(dns_requestmgr_t *requestmgr, const isc_sockaddr_t *srcaddr,
372 disp = dns_dispatchset_get(requestmgr->dispatches4);
376 disp = dns_dispatchset_get(requestmgr->dispatches6);
389 return dns_dispatch_createudp(requestmgr->dispatchmgr, srcaddr,
394 get_dispatch(bool tcp, bool newtcp, dns_requestmgr_t *requestmgr,
400 result = tcp_dispatch(newtcp, requestmgr, srcaddr, destaddr,
403 result = udp_dispatch(requestmgr, srcaddr, destaddr, dispatchp);
409 dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
426 REQUIRE(VALID_REQUESTMGR(requestmgr));
439 mctx = requestmgr->mctx;
445 if (atomic_load_acquire(&requestmgr->shuttingdown)) {
450 if (isblackholed(requestmgr->dispatchmgr, destaddr)) {
475 result = get_dispatch(tcp, newtcp, requestmgr, srcaddr, destaddr,
511 dns_requestmgr_attach(requestmgr, &request->requestmgr);
512 ISC_LIST_APPEND(requestmgr->requests[request->tid], request, link);
538 dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message,
552 REQUIRE(VALID_REQUESTMGR(requestmgr));
567 mctx = requestmgr->mctx;
573 if (atomic_load_acquire(&requestmgr->shuttingdown)) {
578 if (isblackholed(requestmgr->dispatchmgr, destaddr)) {
600 result = get_dispatch(tcp, false, requestmgr, srcaddr, destaddr,
639 dns_requestmgr_attach(requestmgr, &request->requestmgr);
640 ISC_LIST_APPEND(requestmgr->requests[request->tid], request, link);
963 ISC_LIST_UNLINK(request->requestmgr->requests[request->tid],
1027 if (request->requestmgr != NULL) {
1028 dns_requestmgr_detach(&request->requestmgr);