mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
try to connect ten times before we give up
- retries are important if the network isn't ready
This commit is contained in:
parent
5d3fcd496d
commit
f506a1423d
1 changed files with 7 additions and 0 deletions
|
@ -407,9 +407,16 @@ int main(int argc, char **argv)
|
|||
serv_name.sin_addr.s_addr = inet_addr(saddr);
|
||||
serv_name.sin_port = htons(HERMIT_PORT);
|
||||
|
||||
i = 0;
|
||||
retry:
|
||||
ret = connect(s, (struct sockaddr*)&serv_name, sizeof(serv_name));
|
||||
if (ret < 0)
|
||||
{
|
||||
i++;
|
||||
if (i <= 10) {
|
||||
usleep(10000);
|
||||
goto retry;
|
||||
}
|
||||
perror("Proxy -- connection error");
|
||||
close(s);
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue