Lines Matching refs:lwresd
9 /* $Id: lwresd.c,v 1.60 2009/09/02 23:48:01 tbox Exp $ */
43 #include <named/lwresd.h>
273 * Handle lwresd manager objects
279 ns_lwresd_t *lwresd;
288 lwresd = isc_mem_get(mctx, sizeof(ns_lwresd_t));
289 if (lwresd == NULL)
292 lwresd->mctx = NULL;
293 isc_mem_attach(mctx, &lwresd->mctx);
294 lwresd->view = NULL;
295 lwresd->search = NULL;
296 lwresd->refs = 1;
301 lwresd->ndots = cfg_obj_asuint32(obj);
303 lwresd->ndots = 1;
305 RUNTIME_CHECK(isc_mutex_init(&lwresd->lock) == ISC_R_SUCCESS);
307 lwresd->shutting_down = ISC_FALSE;
323 &lwresd->view);
334 lwresd->search = NULL;
335 result = ns_lwsearchlist_create(lwresd->mctx,
336 &lwresd->search);
373 result = ns_lwsearchlist_append(lwresd->search, name);
388 lwresd->ntasks = cfg_obj_asuint32(obj);
390 lwresd->ntasks = ns_g_cpus;
392 if (lwresd->ntasks == 0)
393 lwresd->ntasks = 1;
398 lwresd->nclients = cfg_obj_asuint32(obj);
399 if (lwresd->nclients > LWRESD_NCLIENTS_MAX)
400 lwresd->nclients = LWRESD_NCLIENTS_MAX;
402 lwresd->nclients = 1024;
404 lwresd->nclients = 256;
406 lwresd->magic = LWRESD_MAGIC;
408 *lwresdp = lwresd;
412 if (lwresd->view != NULL)
413 dns_view_detach(&lwresd->view);
414 if (lwresd->search != NULL)
415 ns_lwsearchlist_detach(&lwresd->search);
416 if (lwresd->mctx != NULL)
417 isc_mem_detach(&lwresd->mctx);
418 isc_mem_put(mctx, lwresd, sizeof(ns_lwresd_t));
436 ns_lwresd_t *lwresd;
443 lwresd = *lwresdp;
446 LOCK(&lwresd->lock);
447 INSIST(lwresd->refs > 0);
448 lwresd->refs--;
449 if (lwresd->refs == 0)
451 UNLOCK(&lwresd->lock);
456 dns_view_detach(&lwresd->view);
457 if (lwresd->search != NULL)
458 ns_lwsearchlist_detach(&lwresd->search);
459 mctx = lwresd->mctx;
460 lwresd->magic = 0;
461 isc_mem_put(mctx, lwresd, sizeof(*lwresd));
518 listener_create(isc_mem_t *mctx, ns_lwresd_t *lwresd,
542 ns_lwdmanager_attach(lwresd, &listener->manager);
713 configure_listener(isc_sockaddr_t *address, ns_lwresd_t *lwresd,
722 result = listener_create(mctx, lwresd, &listener);
784 ns_lwresd_t *lwresd = NULL;
814 CHECK(ns_lwdmanager_create(mctx, lwres, &lwresd));
828 CHECK(configure_listener(&address, lwresd, mctx,
837 CHECK(configure_listener(&addrs[i], lwresd,
841 ns_lwdmanager_detach(&lwresd);
870 if (lwresd != NULL)
871 ns_lwdmanager_detach(&lwresd);