[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - 2 commits - loolwsd/LOOLWSD.cpp

Jan Holesovsky kendy at collabora.com
Wed Jan 6 08:30:24 PST 2016


 loolwsd/LOOLWSD.cpp |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 4ab0f6498bffc1009c7dcc323306fee86628322d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 6 15:55:00 2016 +0100

    loolwsd: Answer the PING's with proper PONG's.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index a766f82..154cccd 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -383,7 +383,7 @@ public:
                 // Loop, receiving WebSocket messages either from the client, or from the child
                 // process (to be forwarded to the client).
                 int flags;
-                int n;
+                int n = 0;
                 bool pollTimeout = true;
                 ws->setReceiveTimeout(0);
 
@@ -397,7 +397,8 @@ public:
 
                         if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
                         {
-                            ws->sendFrame("", 0, WebSocket::FRAME_OP_PONG);
+                            ws->sendFrame("PONG", 4);
+                            n = 1;
                         }
                         else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG)
                         {
commit c24878fc87e855ca460200029c0549228d1720d0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Jan 5 12:29:34 2016 -0500

    loolwsd: handle browser ping frames
    
    Change-Id: I6f0074a3f8945b0ffe7a435d40f72f0ef4eae4b8
    Reviewed-on: https://gerrit.libreoffice.org/21132
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index a74d867..a766f82 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -395,7 +395,11 @@ public:
                     {
                         n = ws->receiveFrame(buffer, sizeof(buffer), flags);
 
-                        if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG)
+                        if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
+                        {
+                            ws->sendFrame("", 0, WebSocket::FRAME_OP_PONG);
+                        }
+                        else if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG)
                         {
                             n = 1;
                         }


More information about the Libreoffice-commits mailing list