mirror of https://github.com/aria2/aria2
Fix mysterious 1 second delay with async DNS
parent
e6b6aa324b
commit
ffec92ec57
|
@ -170,9 +170,8 @@ int DHTEntryPointNameResolveCommand::resolveHostname(
|
|||
{
|
||||
if (!asyncNameResolverMan_->started()) {
|
||||
asyncNameResolverMan_->startAsync(hostname, e_, this);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
||||
switch (asyncNameResolverMan_->getStatus()) {
|
||||
case -1:
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_FAILED, getCuid(), hostname.c_str(),
|
||||
|
@ -188,12 +187,12 @@ int DHTEntryPointNameResolveCommand::resolveHostname(
|
|||
return -1;
|
||||
}
|
||||
else {
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, getCuid(),
|
||||
hostname.c_str(), res.front().c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, getCuid(), hostname.c_str(),
|
||||
res.front().c_str()));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unreachable
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,9 +148,8 @@ int NameResolveCommand::resolveHostname(std::vector<std::string>& res,
|
|||
{
|
||||
if (!asyncNameResolverMan_->started()) {
|
||||
asyncNameResolverMan_->startAsync(hostname, e_, this);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
||||
switch (asyncNameResolverMan_->getStatus()) {
|
||||
case -1:
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_FAILED, getCuid(), hostname.c_str(),
|
||||
|
@ -166,12 +165,12 @@ int NameResolveCommand::resolveHostname(std::vector<std::string>& res,
|
|||
return -1;
|
||||
}
|
||||
else {
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, getCuid(),
|
||||
hostname.c_str(), res.front().c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, getCuid(), hostname.c_str(),
|
||||
res.front().c_str()));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unreachable
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue