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:
hsc
2012-04-19 18:02:13 +00:00
parent 8a306f8931
commit 07c4ba886b

View File

@ -41,12 +41,13 @@ bool JobClient::connectToServer()
if(retries > 0) {
// Wait RAND_BACKOFF_TSTART to RAND_BACKOFF_TEND seconds:
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);
usleep(rand() % 1000000);
--retries;
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;
return false; // finally: unable to connect, give it up :-(
}