loolwsd/IoUtil.cpp | 10 +--------- loolwsd/IoUtil.hpp | 3 +-- loolwsd/protocol.txt | 11 ----------- 3 files changed, 2 insertions(+), 22 deletions(-)
New commits: commit 85d275ab1afb05ed937c55cb9ed9c2462a4a7f89 Author: Artyom Sovetnikov <elrin...@gmail.com> Date: Mon Jul 25 23:55:55 2016 +0530 loolwsd: Remove pong frame hack https://github.com/LibreOffice/online/pull/1 diff --git a/loolwsd/IoUtil.cpp b/loolwsd/IoUtil.cpp index 350f3d1..7b8adfc 100644 --- a/loolwsd/IoUtil.cpp +++ b/loolwsd/IoUtil.cpp @@ -45,20 +45,12 @@ int receiveFrame(WebSocket& socket, void* buffer, int length, int& flags) int n = socket.receiveFrame(buffer, length, flags); if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING) { - // 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. - socket.sendFrame("pong", strlen("pong")); + socket.sendFrame(buffer, n, WebSocket::FRAME_FLAG_FIN | WebSocket::FRAME_OP_PONG); } else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG) { // In case we do send pongs in the future. } - else if (((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_TEXT || - (flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_BINARY) && - n == 4 && memcmp((char*)buffer, "pong", 4) == 0) - { - // Ignore what we send above. Be lenient, also ignore binary "pong" frames. - } else { return n; diff --git a/loolwsd/IoUtil.hpp b/loolwsd/IoUtil.hpp index 2584374..3c6eeb9 100644 --- a/loolwsd/IoUtil.hpp +++ b/loolwsd/IoUtil.hpp @@ -22,8 +22,7 @@ namespace IoUtil { // Wrapper for WebSocket::receiveFrame() that handles PING frames (by replying with a - // "pseudo-PONG" frame, see protocol.txt) and PONG frames. Also our "pseudo-PONG" frames are - // ignored. + // PONG frame) and PONG frames. PONG frames are ignored. // Should we also factor out the handling of non-final and continuation frames into this? int receiveFrame(Poco::Net::WebSocket& socket, void* buffer, int length, int& flags); diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt index 8f2412a..2db04d4 100644 --- a/loolwsd/protocol.txt +++ b/loolwsd/protocol.txt @@ -165,13 +165,6 @@ userinactive See 'useractive'. -pong - - Sent instead of a PONG frame as reply to a PING frame. A comment - in our code says "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." - server -> client ================ @@ -315,10 +308,6 @@ unocommandresult: <payload> Callback that an UNO command has finished. See LOK_CALLBACK_UNO_COMMAND_RESULT for details. -pong: - - See above. - invalidateviewcursor: Per-view cursor position invalidation. JSON payload. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits