loolwsd: test: retry connection failures
Change-Id: Iff2cf05bf755ba0df08304af9f2cc6c488e18428 Reviewed-on: https://gerrit.libreoffice.org/30885 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
0cc57c643d
commit
78be068a7f
1 changed files with 15 additions and 6 deletions
|
@ -348,15 +348,24 @@ connectLOKit(const Poco::URI& uri,
|
|||
int retries = 10;
|
||||
do
|
||||
{
|
||||
std::unique_ptr<Poco::Net::HTTPClientSession> session(createSession(uri));
|
||||
auto ws = std::make_shared<LOOLWebSocket>(*session, request, response);
|
||||
const auto expected_response = "statusindicator: ready";
|
||||
if (getResponseString(ws, expected_response, name) == expected_response)
|
||||
try
|
||||
{
|
||||
return ws;
|
||||
std::unique_ptr<Poco::Net::HTTPClientSession> session(createSession(uri));
|
||||
auto ws = std::make_shared<LOOLWebSocket>(*session, request, response);
|
||||
const auto expected_response = "statusindicator: ready";
|
||||
if (getResponseString(ws, expected_response, name) == expected_response)
|
||||
{
|
||||
return ws;
|
||||
}
|
||||
|
||||
std::cerr << (11 - retries);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cerr << std::endl << "Error connecting: " << ex.what() << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << (11 - retries);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(POLL_TIMEOUT_MS));
|
||||
}
|
||||
while (retries--);
|
||||
|
||||
|
|
Loading…
Reference in a new issue