Skip to content

Commit

Permalink
- exit if we cannot connect after we retry 5 times with 2 seconds delay.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7483 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Dec 17, 2010
1 parent a3042af commit c055b5a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions c_runtime/interactive/client.cpp
Expand Up @@ -95,22 +95,24 @@ THREAD_RET_TYPE threadControlClient(void*)

s1.create();

int retries_left = 10;
int retries_left = 5;

for(; retries_left >= 0; --retries_left)
{
if(!s1.connect("127.0.0.1", 10501))
{
if(retries_left)
{
cout << "Connect failed, retrying to connect to 127.0.0.1:10501" << endl; fflush(stdout);
cout << "Connect failed, retrying to connect to 127.0.0.1:10501 after 2 seconds" << endl; fflush(stdout);
delay(2000);
continue;
}
else
{
cout << "Connect failed, max number of retries reached." << endl; fflush(stdout);
run = false;
return 0;
cout << "Exiting..." << endl; fflush(stdout);
exit(1);
}
}

Expand Down

0 comments on commit c055b5a

Please sign in to comment.