Skip to content

Commit 733e226

Browse files
committed
[crorc] Fortify link up assertion
1 parent e5d0398 commit 733e226

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Crorc/CrorcBar.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,17 @@ bool CrorcBar::checkLinkUp()
156156

157157
void CrorcBar::assertLinkUp()
158158
{
159-
auto timeOut = std::chrono::steady_clock::now() + std::chrono::milliseconds(100);
160-
while ((std::chrono::steady_clock::now() < timeOut) && !checkLinkUp()) {
159+
int checkTimes = 1000;
160+
auto timeOut = std::chrono::steady_clock::now() + std::chrono::milliseconds(2000);
161+
while ((std::chrono::steady_clock::now() < timeOut) && checkTimes) {
162+
if (checkLinkUp()) {
163+
checkTimes--;
164+
} else {
165+
checkTimes = 1000;
166+
}
161167
}
168+
169+
std::this_thread::sleep_for(500ms);
162170
if (!checkLinkUp()) {
163171
BOOST_THROW_EXCEPTION(CrorcCheckLinkException() << ErrorInfo::Message("Link was not up"));
164172
}

0 commit comments

Comments
 (0)