summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-12-31 13:27:52 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-12-31 13:27:52 (GMT)
commit152c455e18aae9b613f17bca8bba4a2beafe0228 (patch)
treecde533a0bf5dbe014acba3eb2645761ade53dd20 /Swiften/Network/StaticDomainNameResolver.cpp
parent3625bf9f94aad738b6d44da4b8f70c60cd167647 (diff)
downloadswift-contrib-152c455e18aae9b613f17bca8bba4a2beafe0228.zip
swift-contrib-152c455e18aae9b613f17bca8bba4a2beafe0228.tar.bz2
Added tests for timing out initial connect.
Diffstat (limited to 'Swiften/Network/StaticDomainNameResolver.cpp')
-rw-r--r--Swiften/Network/StaticDomainNameResolver.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp
index 609bbdd..a7275d2 100644
--- a/Swiften/Network/StaticDomainNameResolver.cpp
+++ b/Swiften/Network/StaticDomainNameResolver.cpp
@@ -13,6 +13,9 @@ namespace {
ServiceQuery(const String& service, Swift::StaticDomainNameResolver* resolver) : service(service), resolver(resolver) {}
virtual void run() {
+ if (!resolver->getIsResponsive()) {
+ return;
+ }
std::vector<DomainNameServiceQuery::Result> results;
for(StaticDomainNameResolver::ServicesCollection::const_iterator i = resolver->getServices().begin(); i != resolver->getServices().end(); ++i) {
if (i->first == service) {
@@ -30,6 +33,9 @@ namespace {
AddressQuery(const String& host, StaticDomainNameResolver* resolver) : host(host), resolver(resolver) {}
virtual void run() {
+ if (!resolver->getIsResponsive()) {
+ return;
+ }
StaticDomainNameResolver::AddressesMap::const_iterator i = resolver->getAddresses().find(host);
if (i != resolver->getAddresses().end()) {
MainEventLoop::postEvent(
@@ -48,6 +54,9 @@ namespace {
namespace Swift {
+StaticDomainNameResolver::StaticDomainNameResolver() : isResponsive(true) {
+}
+
void StaticDomainNameResolver::addAddress(const String& domain, const HostAddress& address) {
addresses[domain] = address;
}