loolwsd/test/helpers.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit b6926c2f4c9e7eb33cfbb5224e4675c4b1e67347 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sat Nov 12 13:25:35 2016 -0500 loolwsd: proper retrying in connectLOKit Change-Id: Ib99a6012510457876f422767cf42b92f412df1f5 Reviewed-on: https://gerrit.libreoffice.org/30817 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/test/helpers.hpp b/loolwsd/test/helpers.hpp index 4f12c2e..6b291d8 100644 --- a/loolwsd/test/helpers.hpp +++ b/loolwsd/test/helpers.hpp @@ -343,20 +343,24 @@ connectLOKit(const Poco::URI& uri, Poco::Net::HTTPResponse& response, const std::string& name = "") { + std::cerr << name << "Connecting... "; int retries = 10; do { std::unique_ptr<Poco::Net::HTTPClientSession> session(createSession(uri)); - - std::cerr << name << "Connecting... " << std::endl; auto ws = std::make_shared<LOOLWebSocket>(*session, request, response); - getResponseMessage(ws, "statusindicator: ready", name); + const auto expected_response = "statusindicator: ready"; + if (getResponseString(ws, expected_response, name) == expected_response) + { + return ws; + } - return ws; + std::cerr << (11 - retries); } while (retries--); - CPPUNIT_FAIL("Cannot connect to [" + uri.toString() + "]."); + std::cerr << std::endl; + throw std::runtime_error("Cannot connect to [" + uri.toString() + "]."); } inline _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits