diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-24 23:12:28 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-24 23:12:28 +0200 |
commit | 460e57b642172f279e8faebeb7a02451cbf31dce (patch) | |
tree | 473d41caf783defb5da1bf817ffa7bdf48a7b9a6 | |
parent | fa94d8b426b359557464361799ac4eb0888bf92a (diff) | |
download | sink-460e57b642172f279e8faebeb7a02451cbf31dce.tar.gz sink-460e57b642172f279e8faebeb7a02451cbf31dce.zip |
A faster method for a failing connection
-rw-r--r-- | examples/imapresource/tests/imapmailsynctest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/imapresource/tests/imapmailsynctest.cpp b/examples/imapresource/tests/imapmailsynctest.cpp index 06369f3..76023e1 100644 --- a/examples/imapresource/tests/imapmailsynctest.cpp +++ b/examples/imapresource/tests/imapmailsynctest.cpp | |||
@@ -69,9 +69,13 @@ protected: | |||
69 | Sink::ApplicationDomain::SinkResource createFaultyResource() Q_DECL_OVERRIDE | 69 | Sink::ApplicationDomain::SinkResource createFaultyResource() Q_DECL_OVERRIDE |
70 | { | 70 | { |
71 | auto resource = ApplicationDomain::ImapResource::create("account1"); | 71 | auto resource = ApplicationDomain::ImapResource::create("account1"); |
72 | //Using a bogus ip instead of a bogus hostname avoids getting stuck in the hostname lookup | 72 | //We try to connect on localhost on port 0 because: |
73 | resource.setProperty("server", "111.111.1.1"); | 73 | //* Using a bogus ip instead of a bogus hostname avoids getting stuck in the hostname lookup. |
74 | resource.setProperty("port", 143); | 74 | //* Using localhost avoids tcp trying to retransmit packets into nirvana |
75 | //* Using port 0 fails immediately because it's not an existing port. | ||
76 | //All we really want is something that immediately rejects our connection attempt, and this seems to work. | ||
77 | resource.setProperty("server", "127.0.0.1"); | ||
78 | resource.setProperty("port", 0); | ||
75 | resource.setProperty("username", "doe"); | 79 | resource.setProperty("username", "doe"); |
76 | Sink::SecretStore::instance().insert(resource.identifier(), "doe"); | 80 | Sink::SecretStore::instance().insert(resource.identifier(), "doe"); |
77 | return resource; | 81 | return resource; |