mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
make connecting channel wait loop more flexible
This commit is contained in:
parent
ee0d2e0c55
commit
f963a06e25
|
@ -227,20 +227,20 @@ void FairMQDevice::InitWrapper()
|
||||||
|
|
||||||
// go over the list of channels until all are initialized (and removed from the uninitialized list)
|
// go over the list of channels until all are initialized (and removed from the uninitialized list)
|
||||||
int numAttempts = 0;
|
int numAttempts = 0;
|
||||||
|
auto sleepTimeInMS = 50;
|
||||||
|
auto maxAttempts = fInitializationTimeoutInS * 1000 / sleepTimeInMS;
|
||||||
while (!uninitializedConnectingChannels.empty())
|
while (!uninitializedConnectingChannels.empty())
|
||||||
{
|
{
|
||||||
AttachChannels(uninitializedConnectingChannels);
|
AttachChannels(uninitializedConnectingChannels);
|
||||||
if (++numAttempts > fInitializationTimeoutInS)
|
if (numAttempts > maxAttempts)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "could not connect all channels after " << fInitializationTimeoutInS << " attempts";
|
LOG(ERROR) << "could not connect all channels after " << fInitializationTimeoutInS << " attempts";
|
||||||
// TODO: goto ERROR state;
|
// TODO: goto ERROR state;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numAttempts != 0)
|
this_thread::sleep_for(chrono::milliseconds(sleepTimeInMS));
|
||||||
{
|
numAttempts++;
|
||||||
this_thread::sleep_for(chrono::milliseconds(1000));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user