Call cancel callbacks only when callback exists

This commit is contained in:
Willem Toorop 2017-02-17 23:39:35 +01:00
parent 6ed3d77523
commit 7e9956b19e
1 changed files with 5 additions and 3 deletions

View File

@ -3275,9 +3275,11 @@ _getdns_context_request_timed_out(getdns_dns_req *req)
/* cancel the req - also clears it from outbound and cleans up*/
_getdns_context_cancel_request(context, trans_id, 0);
context->processing = 1;
cb(context, GETDNS_CALLBACK_TIMEOUT, response, user_arg, trans_id);
context->processing = 0;
if (cb) {
context->processing = 1;
cb(context, GETDNS_CALLBACK_TIMEOUT, response, user_arg, trans_id);
context->processing = 0;
}
getdns_context_request_count_changed(context);
return GETDNS_RETURN_GOOD;
}