fixed invalid DNS cancel
This commit is contained in:
parent
b6dade6fc8
commit
62bd63b6a9
@ -263,17 +263,19 @@ void Resolver::evtimer_dns_callback(Resolver::dns_request *request) {
|
|||||||
auto err = this->dnsapi.DnsCancelQuery(&request->dns_cancel);
|
auto err = this->dnsapi.DnsCancelQuery(&request->dns_cancel);
|
||||||
if(err != 0)
|
if(err != 0)
|
||||||
std::cerr << "Failed to cancel timeouted DNS request" << std::endl;
|
std::cerr << "Failed to cancel timeouted DNS request" << std::endl;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
request->callback(ResultState::DNS_TIMEOUT, 0, nullptr);
|
request->callback(ResultState::DNS_TIMEOUT, 0, nullptr);
|
||||||
this->destroy_dns_request(request);
|
this->destroy_dns_request(request);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Resolver::dns_callback(Resolver::dns_request *request) {
|
void Resolver::dns_callback(Resolver::dns_request *request) {
|
||||||
if(request->dns_result.QueryStatus != ERROR_SUCCESS) {
|
if(request->dns_result.QueryStatus != ERROR_SUCCESS) {
|
||||||
auto status = request->dns_result.QueryStatus;
|
auto status = request->dns_result.QueryStatus;
|
||||||
if(status >= DNS_ERROR_RESPONSE_CODES_BASE && status <= DNS_ERROR_RCODE_LAST)
|
if(status >= DNS_ERROR_RESPONSE_CODES_BASE && status <= DNS_ERROR_RCODE_LAST)
|
||||||
request->callback(ResultState::DNS_FAIL, request->dns_result.QueryStatus - DNS_ERROR_RESPONSE_CODES_BASE, nullptr);
|
request->callback(ResultState::DNS_FAIL, request->dns_result.QueryStatus - DNS_ERROR_RESPONSE_CODES_BASE, nullptr);
|
||||||
|
else if(status == ERROR_CANCELLED)
|
||||||
|
request->callback(ResultState::DNS_TIMEOUT, 0, nullptr);
|
||||||
else
|
else
|
||||||
request->callback(ResultState::DNS_API_FAIL, request->dns_result.QueryStatus, nullptr);
|
request->callback(ResultState::DNS_API_FAIL, request->dns_result.QueryStatus, nullptr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -330,6 +330,7 @@ struct CrStatus {
|
|||||||
|
|
||||||
assert(this->pending > 0);
|
assert(this->pending > 0);
|
||||||
if(--pending == 0 && !this->finished) { //Order matters we have to decrease pensing!
|
if(--pending == 0 && !this->finished) { //Order matters we have to decrease pensing!
|
||||||
|
this->print_status();
|
||||||
this->callback(false, "no results");
|
this->callback(false, "no results");
|
||||||
this->finished = true;
|
this->finished = true;
|
||||||
return;
|
return;
|
||||||
@ -399,15 +400,17 @@ struct CrStatus {
|
|||||||
else \
|
else \
|
||||||
std::cout << #element << ": success: " << std::get<2>(element).host << ":" << std::get<2>(element).port << std::endl;
|
std::cout << #element << ": success: " << std::get<2>(element).host << ":" << std::get<2>(element).port << std::endl;
|
||||||
|
|
||||||
void call_answer(const tc::dns::ServerAddress& data) {
|
void print_status() {
|
||||||
answer_log(this->subsrv_ts, this->execute_subsrv_ts);
|
answer_log(this->subsrv_ts, this->execute_subsrv_ts);
|
||||||
answer_log(this->subsrv_ts3, this->execute_subsrv_ts3);
|
answer_log(this->subsrv_ts3, this->execute_subsrv_ts3);
|
||||||
answer_log(this->tsdns, this->execute_tsdns);
|
answer_log(this->tsdns, this->execute_tsdns);
|
||||||
answer_log(this->subdomain, this->execute_subdomain);
|
answer_log(this->subdomain, this->execute_subdomain);
|
||||||
answer_log(this->rootsrv, this->execute_rootsrv);
|
answer_log(this->rootsrv, this->execute_rootsrv);
|
||||||
answer_log(this->rootdomain, this->execute_rootdomain);
|
answer_log(this->rootdomain, this->execute_rootdomain);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Print data
|
void call_answer(const tc::dns::ServerAddress& data) {
|
||||||
|
this->print_status();
|
||||||
this->callback(true, data);
|
this->callback(true, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user