From 87ab07c0974ec2bd456bf48d9f5795ca892cb3e5 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Wed, 17 Oct 2018 18:23:01 -0700 Subject: [PATCH] Attempt to contact DPlus round-robin server three times --- DPlusAuthenticator.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/DPlusAuthenticator.cpp b/DPlusAuthenticator.cpp index 47b158e..2b51855 100644 --- a/DPlusAuthenticator.cpp +++ b/DPlusAuthenticator.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -54,8 +56,18 @@ bool CDPlusAuthenticator::Process(std::map &gwy_map, c int result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr); if (result) { - fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(result)); - return false; + fprintf(stderr, "1st attempt: getaddrinfo: %s\n", gai_strerror(result)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr); + if (result) { + fprintf(stderr, "2nd attempt: getaddrinfo: %s\n", gai_strerror(result)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr); + if (result) { + fprintf(stderr, "3rd attempt: getaddrinfo: %s\n", gai_strerror(result)); + return false; + } + } } struct addrinfo *p;