summaryrefslogtreecommitdiff
path: root/src/DownloadEngine.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-03 08:18:58 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-03 08:18:58 +0000
commit928e228c89437672b9239a11eb5b4e41357cb90a (patch)
tree623bc0239a91ab9d87dcaf11962bc223c9944203 /src/DownloadEngine.cc
parent220a483004ca1d644e6d7a8760eac931ad525257 (diff)
2008-11-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
DNSCache is now part of DownloadEngine. * src/DNSCache.h * src/DownloadEngine.cc * src/DownloadEngine.h * src/InitiateConnectionCommand.cc * src/MultiUrlRequestInfo.cc * test/Makefile.am * test/Makefile.in * test/SimpleDNSCacheTest.cc
Diffstat (limited to 'src/DownloadEngine.cc')
-rw-r--r--src/DownloadEngine.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc
index 34dd2073..c64384c1 100644
--- a/src/DownloadEngine.cc
+++ b/src/DownloadEngine.cc
@@ -62,6 +62,7 @@
#include "ServerStatMan.h"
#include "CookieStorage.h"
#include "A2STR.h"
+#include "DNSCache.h"
#include "BtRegistry.h"
#include "BtContext.h"
@@ -411,7 +412,8 @@ DownloadEngine::DownloadEngine():logger(LogFactory::getInstance()),
_haltRequested(false),
_noWait(false),
_cookieStorage(new CookieStorage()),
- _btRegistry(new BtRegistry())
+ _btRegistry(new BtRegistry()),
+ _dnsCache(new SimpleDNSCache())
{
#ifdef HAVE_EPOLL
@@ -1064,4 +1066,16 @@ CUID DownloadEngine::newCUID()
return _cuidCounter.newID();
}
+const std::string& DownloadEngine::findCachedIPAddress
+(const std::string& hostname) const
+{
+ return _dnsCache->find(hostname);
+}
+
+void DownloadEngine::cacheIPAddress
+(const std::string& hostname, const std::string& ipaddr)
+{
+ _dnsCache->put(hostname, ipaddr);
+}
+
} // namespace aria2