|
@ -177,12 +177,12 @@ int create_and_bind(const char *host, const char *port) |
|
|
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; /* For wildcard IP address */ |
|
|
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; /* For wildcard IP address */ |
|
|
hints.ai_protocol = IPPROTO_TCP; |
|
|
hints.ai_protocol = IPPROTO_TCP; |
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) { |
|
|
|
|
|
|
|
|
for (int i = 1; i < 8; i++) { |
|
|
s = getaddrinfo(host, port, &hints, &result); |
|
|
s = getaddrinfo(host, port, &hints, &result); |
|
|
if (s == 0) break; |
|
|
if (s == 0) break; |
|
|
else { |
|
|
else { |
|
|
sleep(pow(2, i)); |
|
|
sleep(pow(2, i)); |
|
|
LOGE("failed to resolve server name, wait for %.0fs", pow(2, i)); |
|
|
|
|
|
|
|
|
LOGE("failed to resolve server name, wait %.0f seconds", pow(2, i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|