wait on authorization

lastudp
Tom Early 7 years ago
parent 5fbda881cc
commit d20f576abc

@ -54,20 +54,17 @@ bool CDPlusAuthenticator::Process(std::map<std::string, std::string> &gwy_map, c
hints.ai_family = AF_INET; // AF_INET means IPv4 only addresses hints.ai_family = AF_INET; // AF_INET means IPv4 only addresses
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
int result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr); int result = EAI_AGAIN;
if (result) { while (EAI_AGAIN == result) {
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); result = getaddrinfo(m_address.c_str(), NULL, &hints, &infoptr);
if (result) { if (EAI_AGAIN == result) {
fprintf(stderr, "3rd attempt: getaddrinfo: %s\n", gai_strerror(result)); fprintf(stdout, "getaddrinfo not ready: please wait...");
return false; std::this_thread::sleep_for(std::chrono::milliseconds(2000));
} }
} }
if (result) {
fprintf(stderr, "DPlus Authroization failed: %s\n", gai_strerror(result));
return false;
} }
struct addrinfo *p; struct addrinfo *p;

Loading…
Cancel
Save

Powered by TurnKey Linux.