bind/bind97-rh699951.patch

47 lines
1.7 KiB
Diff

--- bind-9.8.0-P4/lib/dns/request.c.test 2011-08-04 19:13:34.300999355 +0200
+++ bind-9.8.0-P4/lib/dns/request.c 2011-08-04 19:37:40.347002723 +0200
@@ -97,6 +97,7 @@ struct dns_request {
synchronously canceled */
#define DNS_REQUEST_F_TIMEDOUT 0x0008 /*%< canceled due to a timeout */
#define DNS_REQUEST_F_TCP 0x0010 /*%< This request used TCP */
+#define DNS_REQUEST_F_RESPONSE 0x0020 /*%< We got response */
#define DNS_REQUEST_CANCELED(r) \
(((r)->flags & DNS_REQUEST_F_CANCELED) != 0)
#define DNS_REQUEST_CONNECTING(r) \
@@ -105,6 +106,8 @@ struct dns_request {
(((r)->flags & DNS_REQUEST_F_SENDING) != 0)
#define DNS_REQUEST_TIMEDOUT(r) \
(((r)->flags & DNS_REQUEST_F_TIMEDOUT) != 0)
+#define DNS_REQUEST_RESPONSE(r) \
+ (((r)->flags & DNS_REQUEST_F_RESPONSE) != 0)
/***
@@ -1312,9 +1315,15 @@ req_senddone(isc_task_t *task, isc_event
if (DNS_REQUEST_CANCELED(request)) {
/*
- * Send delayed event.
+ * Response can arrive before we proccess
+ * req_senddone which means we received cancellation
+ * request from req_response(). If we successfully
+ * fetched response, send success. Otherwise
+ * indicate failure.
*/
- if (DNS_REQUEST_TIMEDOUT(request))
+ if (DNS_REQUEST_RESPONSE(request))
+ send_if_done(request, ISC_R_SUCCESS);
+ else if (DNS_REQUEST_TIMEDOUT(request))
send_if_done(request, ISC_R_TIMEDOUT);
else
send_if_done(request, ISC_R_CANCELED);
@@ -1367,6 +1376,8 @@ req_response(isc_task_t *task, isc_event
/*
* Send completion event.
*/
+ if (result == ISC_R_SUCCESS)
+ request->flags |= DNS_REQUEST_F_RESPONSE;
send_if_done(request, result);
UNLOCK(&request->requestmgr->locks[request->hash]);
}