瀏覽代碼

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.
Tatsuhiro Tsujikawa 12 年之前
父節點
當前提交
2e39fd6273
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/AsyncNameResolverMan.cc

+ 9 - 0
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);
   }