jobclient: more jitter for reconnects
+typo git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1121 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -41,12 +41,13 @@ bool JobClient::connectToServer()
|
|||||||
if(retries > 0) {
|
if(retries > 0) {
|
||||||
// Wait RAND_BACKOFF_TSTART to RAND_BACKOFF_TEND seconds:
|
// Wait RAND_BACKOFF_TSTART to RAND_BACKOFF_TEND seconds:
|
||||||
int delay = rand() % (RAND_BACKOFF_TEND-RAND_BACKOFF_TSTART) + RAND_BACKOFF_TSTART;
|
int delay = rand() % (RAND_BACKOFF_TEND-RAND_BACKOFF_TSTART) + RAND_BACKOFF_TSTART;
|
||||||
cout << "[Client] Retrying to connect to server in " << delay << "s..." << endl;
|
cout << "[Client] Retrying to connect to server in ~" << delay << "s..." << endl;
|
||||||
sleep(delay);
|
sleep(delay);
|
||||||
|
usleep(rand() % 1000000);
|
||||||
--retries;
|
--retries;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cout << "|Client] Unable to reconnect (tried " << RETRY_COUNT << " times); "
|
cout << "[Client] Unable to reconnect (tried " << RETRY_COUNT << " times); "
|
||||||
<< "I'll give it up!" << endl;
|
<< "I'll give it up!" << endl;
|
||||||
return false; // finally: unable to connect, give it up :-(
|
return false; // finally: unable to connect, give it up :-(
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user