/*
- * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2009-2010 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: client.c,v 1.6 2009/10/27 22:46:13 each Exp $ */
+/* $Id: client.c,v 1.7 2010/04/13 19:06:48 sar Exp $ */
#include <config.h>
return (ISC_R_SUCCESS);
cleanup:
+ if (taskmgr != NULL)
+ isc_taskmgr_destroy(&taskmgr);
if (timermgr != NULL)
isc_timermgr_destroy(&timermgr);
if (socketmgr != NULL)
isc_socketmgr_destroy(&socketmgr);
- if (taskmgr != NULL)
- isc_taskmgr_destroy(&taskmgr);
if (actx != NULL)
isc_appctx_destroy(&actx);
isc_mem_detach(&mctx);
client->dispatchmgr = dispatchmgr;
/* TODO: whether to use dispatch v4 or v6 should be configurable */
+ client->dispatchv4 = NULL;
+ client->dispatchv6 = NULL;
result = getudpdispatch(AF_INET, dispatchmgr, socketmgr,
taskmgr, ISC_TRUE, &dispatchv4);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
- client->dispatchv4 = dispatchv4;
+ if (result == ISC_R_SUCCESS)
+ client->dispatchv4 = dispatchv4;
result = getudpdispatch(AF_INET6, dispatchmgr, socketmgr,
taskmgr, ISC_TRUE, &dispatchv6);
- if (result != ISC_R_SUCCESS)
+ if (result == ISC_R_SUCCESS)
+ client->dispatchv6 = dispatchv6;
+
+ /* We need at least one of the dispatchers */
+ if (dispatchv4 == NULL && dispatchv6 == NULL) {
+ INSIST(result != ISC_R_SUCCESS);
goto cleanup;
- client->dispatchv6 = dispatchv6;
+ }
/* Create the default view for class IN */
result = dns_client_createview(mctx, dns_rdataclass_in, options,