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

Pranav Kant pranavk at collabora.co.uk
Fri Mar 18 18:22:19 UTC 2016


 loolwsd/LOOLSession.cpp |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit bc905a3ccce01143557d922edb5eb5b8df4118a9
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jan 27 14:35:54 2016 +0530

    bccu#1468: handle 'nextmessage:' in prisoner -> master text frames
    
    There are cases when prisoner would send huge text data but
    without preceeding 'nextmessage' frames making the master throw
    WebSocketException.
    
    Conflicts:
    	loolwsd/LOOLSession.cpp
    	loolwsd/LOOLWSD.cpp
    
    Change-Id: Ibe44b69f4ab75c1b8096648c6006316c88366e7c
    Reviewed-on: https://gerrit.libreoffice.org/21835
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index a77df51..16fc4d8 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -117,8 +117,14 @@ LOOLSession::~LOOLSession()
 void LOOLSession::sendTextFrame(const std::string& text)
 {
     std::unique_lock<std::mutex> lock(_mutex);
+    const int length = text.size();
+    if (length > 1000)
+    {
+        const std::string nextmessage = "nextmessage: size=" + std::to_string(length);
+        _ws->sendFrame(nextmessage.data(), nextmessage.size());
+    }
 
-    _ws->sendFrame(text.data(), text.size());
+    _ws->sendFrame(text.data(), length);
 }
 
 void LOOLSession::sendBinaryFrame(const char *buffer, int length)


More information about the Libreoffice-commits mailing list