diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-01-15 12:15:11 -0500 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-01-16 01:45:03 +0000 |
commit | 8cbf478bfe2e8b947f42f02b8224d71cd9ef1f6b (patch) | |
tree | 46345bd4b11168c2b496ee9a9f6b545a8a2b8539 /test/helpers.hpp | |
parent | e0dcc7a972e1923605b02f9c7a0bd0cadf5aafef (diff) |
wsd: improved getErrorCode
Change-Id: I89b36b5e69cbbe05ac7b1730633d695bc5185823
Reviewed-on: https://gerrit.libreoffice.org/33117
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'test/helpers.hpp')
-rw-r--r-- | test/helpers.hpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/helpers.hpp b/test/helpers.hpp index fce1cfdf6..4dd8f86a6 100644 --- a/test/helpers.hpp +++ b/test/helpers.hpp @@ -162,7 +162,7 @@ std::string const & getTestServerURI() } inline -int getErrorCode(LOOLWebSocket& ws, std::string& message) +int getErrorCode(LOOLWebSocket& ws, std::string& message, const std::string& testname = "") { int flags = 0; int bytes = 0; @@ -170,13 +170,13 @@ int getErrorCode(LOOLWebSocket& ws, std::string& message) Poco::Buffer<char> buffer(READ_BUFFER_SIZE); message.clear(); - Poco::Timespan timeout(5000000); - ws.setReceiveTimeout(timeout); + ws.setReceiveTimeout(Poco::Timespan(5000000)); do { bytes = ws.receiveFrame(buffer.begin(), READ_BUFFER_SIZE, flags); + std::cerr << testname << "Got " << LOOLProtocol::getAbbreviatedFrameDump(buffer.begin(), bytes, flags) << std::endl; } - while ((flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE); + while (bytes > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE); if (bytes > 0) { @@ -189,9 +189,9 @@ int getErrorCode(LOOLWebSocket& ws, std::string& message) } inline -int getErrorCode(const std::shared_ptr<LOOLWebSocket>& ws, std::string& message) +int getErrorCode(const std::shared_ptr<LOOLWebSocket>& ws, std::string& message, const std::string& testname = "") { - return getErrorCode(*ws, message); + return getErrorCode(*ws, message, testname); } inline |