[Libreoffice-commits] online.git: loolwsd/test
Mike Kaganski
mike.kaganski at collabora.com
Tue Jun 21 23:07:53 UTC 2016
loolwsd/test/httpwstest.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 47a17fa8d017b12c6e15f3ec5566fcbff96a3118
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Tue Jun 21 22:19:13 2016 +1000
testCloseAfterClose: don't hang on bytes==0 && flags==0
At least in some versions of Poco (namely, 1.7.3),
WebSocketImpl::receiveBytes may return both bytes and flags equal
to zero. It makes the HTTPWSTest::testCloseAfterClose() loop
exit condition to never happen, thus test hangs.
According to WebSoket.h, "A return value of 0 means that the peer
has shut down or closed the connection".
Thus, this modification makes this loop robust.
Change-Id: I5dd4f30936dd8246c966f094f2fdae9a45b89ff9
Reviewed-on: https://gerrit.libreoffice.org/26547
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 6b8cb0f..9061641 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -307,7 +307,7 @@ void HTTPWSTest::testCloseAfterClose()
{
bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
}
- while ((flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE);
+ while (bytes && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE);
// no more messages is received.
bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
More information about the Libreoffice-commits
mailing list