summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-13 21:16:53 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-13 21:16:53 +0900
commit2e39fd6273b192d560c576f6fe42119255231f5a (patch)
treeaf60a8592faf949e7fe9ef5b16934fdbb13c38ad
parent994eb551f18bbaea399b5fc564df80dd18a241c7 (diff)
Check configured addresses again if previous check found none of them
Currently, aria2 checks configured addresses at the startup. But there are chances that interfaces are not setup at that moment. For example, if aria2 is used as daemon, it may start before network interfaces up. To workaround this, we check addresses again if both addresses are not configured at the startup.
-rw-r--r--src/AsyncNameResolverMan.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/AsyncNameResolverMan.cc b/src/AsyncNameResolverMan.cc
index 2b418394..90f08844 100644
--- a/src/AsyncNameResolverMan.cc
+++ b/src/AsyncNameResolverMan.cc
@@ -202,6 +202,15 @@ void AsyncNameResolverMan::reset(DownloadEngine* e, Command* command)
void configureAsyncNameResolverMan(AsyncNameResolverMan* asyncNameResolverMan,
Option* option)
{
+ // Currently, aria2 checks configured addresses at the startup. But
+ // there are chances that interfaces are not setup at that
+ // moment. For example, if aria2 is used as daemon, it may start
+ // before network interfaces up. To workaround this, we check
+ // addresses again if both addresses are not configured at the
+ // startup.
+ if(!net::getIPv4AddrConfigured() && !net::getIPv6AddrConfigured()) {
+ net::checkAddrconfig();
+ }
if(!net::getIPv4AddrConfigured()) {
asyncNameResolverMan->setIPv4(false);
}