[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Jan 24 13:02:35 PST 2016
loolwsd/Common.hpp | 2 +-
loolwsd/LOOLWSD.cpp | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 9593ec5720704c910d3e2a733d092625f23fed68
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Jan 23 17:35:16 2016 -0500
loolwsd: improved polling and pong with client
Change-Id: I17c4f7685d23b6e4c84a7f8b34fcb7dbcaf959f9
Reviewed-on: https://gerrit.libreoffice.org/21754
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index ff98222..f85f76d 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -18,7 +18,7 @@ constexpr int MASTER_PORT_NUMBER = 9981;
constexpr int INTERVAL_PROBES = 10;
constexpr int MAINTENANCE_INTERVAL = 1;
constexpr int CHILD_TIMEOUT_SECS = 10;
-constexpr int POLL_TIMEOUT_MS = 500;
+constexpr int POLL_TIMEOUT_MS = 1000;
/// Pipe and Socket read buffer size.
/// Should be large enough for ethernet packets
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 91da2f9..4db32fb 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -200,7 +200,7 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
{
Log::info("Starting Socket Processor.");
- const Poco::Timespan waitTime(POLL_TIMEOUT_MS);
+ const Poco::Timespan waitTime(POLL_TIMEOUT_MS * 1000);
try
{
int flags = 0;
@@ -217,17 +217,22 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
{
// Echo back the ping payload as pong.
- ws->sendFrame(buffer, n, WebSocket::FRAME_OP_PONG);
- continue;
+ // Technically, we should send back a PONG control frame.
+ // However Firefox (probably) or Node.js (possibly) doesn't
+ // like that and closes the socket when we do.
+ // Echoing the payload as a normal frame works with Firefox.
+ ws->sendFrame(buffer, n /*, WebSocket::FRAME_OP_PONG*/);
}
else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG)
{
// In case we do send pings in the future.
- continue;
}
else if (n <= 0)
{
// Connection closed.
+ Log::warn() << "Received " << n
+ << " bytes. Connection closed. Flags: "
+ << std::hex << flags << Log::end;
break;
}
else
More information about the Libreoffice-commits
mailing list