* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.384.14.34 2011/10/12 01:40:32 marka Exp $ */
+/* $Id: resolver.c,v 1.384.14.35 2011/11/02 23:48:41 marka Exp $ */
/*! \file */
dns_dispatch_detach(&query->dispatch);
cleanup_query:
- query->magic = 0;
- isc_mem_put(res->buckets[fctx->bucketnum].mctx,
- query, sizeof(*query));
+ if (query->connects == 0) {
+ query->magic = 0;
+ isc_mem_put(res->buckets[fctx->bucketnum].mctx,
+ query, sizeof(*query));
+ }
stop_idle_timer:
RUNTIME_CHECK(fctx_stopidletimer(fctx) == ISC_R_SUCCESS);
dns_compress_t cctx;
isc_boolean_t cleanup_cctx = ISC_FALSE;
isc_boolean_t secure_domain;
+ isc_boolean_t connecting = ISC_FALSE;
fctx = query->fctx;
QTRACE("send");
query);
if (result != ISC_R_SUCCESS)
goto cleanup_message;
+ connecting = ISC_TRUE;
query->connects++;
}
}
*/
result = isc_socket_sendto(socket, &r, task, resquery_senddone,
query, address, NULL);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ if (connecting) {
+ /*
+ * This query is still connecting.
+ * Mark it as canceled so that it will just be
+ * cleaned up when the connected event is received.
+ * Keep fctx around until the event is processed.
+ */
+ query->fctx->nqueries++;
+ query->attributes |= RESQUERY_ATTR_CANCELED;
+ }
goto cleanup_message;
+ }
query->sends++;