[Libreoffice-commits] online.git: common/LOOLWebSocket.hpp net/Socket.hpp net/WebSocketHandler.hpp

Michael Meeks michael.meeks at collabora.com
Wed Apr 19 09:02:19 UTC 2017


 common/LOOLWebSocket.hpp |    9 ++++++---
 net/Socket.hpp           |   11 +++++++----
 net/WebSocketHandler.hpp |    6 ++++--
 3 files changed, 17 insertions(+), 9 deletions(-)

New commits:
commit f72b7d2ba1a37ab1ece64908462e2ec84787e628
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Apr 19 10:58:18 2017 +0200

    Don't set the buffer size to zero.
    
    This slows things down terribly, particularly the setting on the websocket
    made tiles appearing one by one. Let's keep the possibility to zero the buffer
    sizes for debugging, but hide that behind an env. variable (and in debug
    builds only anyway).
    
    Change-Id: Ie4d2cdb3c0ec3c50f1a2b4f9941a462ac4f2d196

diff --git a/common/LOOLWebSocket.hpp b/common/LOOLWebSocket.hpp
index 784a0915..73660e96 100644
--- a/common/LOOLWebSocket.hpp
+++ b/common/LOOLWebSocket.hpp
@@ -51,9 +51,12 @@ private:
 
     void setMinSocketBufferSize()
     {
-        // Lets set it to zero as system will automatically adjust it to minimum
-        setSendBufferSize(0);
-        LOG_INF("Send buffer size for web socket set to minimum: " << getSendBufferSize());
+        if (std::getenv("LOOL_ZERO_BUFFER_SIZE"))
+        {
+            // Lets set it to zero as system will automatically adjust it to minimum
+            setSendBufferSize(0);
+            LOG_INF("Send buffer size for web socket set to minimum: " << getSendBufferSize());
+        }
     }
 #endif
 
diff --git a/net/Socket.hpp b/net/Socket.hpp
index c0b4b97e..70b229b3 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -226,10 +226,13 @@ protected:
                 _owner << "." << std::dec);
 
 #if ENABLE_DEBUG
-        const int oldSize = getSocketBufferSize();
-        setSocketBufferSize(0);
-        LOG_TRC("#" << _fd << ": Buffer size: " << getSendBufferSize() <<
-                " (was " << oldSize << ")");
+        if (std::getenv("LOOL_ZERO_BUFFER_SIZE"))
+        {
+            const int oldSize = getSocketBufferSize();
+            setSocketBufferSize(0);
+            LOG_TRC("#" << _fd << ": Buffer size: " << getSendBufferSize() <<
+                    " (was " << oldSize << ")");
+        }
 #endif
     }
 
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index c6d69883..a863afad 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -417,9 +417,11 @@ protected:
         LOG_INF("#" << socket->getFD() << ": WebSocket version: " << wsVersion <<
                 ", key: [" << wsKey << "], protocol: [" << wsProtocol << "].");
 
-        // Want very low latency sockets.
         socket->setNoDelay();
-        socket->setSocketBufferSize(0);
+#if ENABLE_DEBUG
+        if (std::getenv("LOOL_ZERO_BUFFER_SIZE"))
+            socket->setSocketBufferSize(0);
+#endif
 
         std::ostringstream oss;
         oss << "HTTP/1.1 101 Switching Protocols\r\n"


More information about the Libreoffice-commits mailing list