common/LOOLWebSocket.hpp | 52 +++++------------------------------------------ 1 file changed, 6 insertions(+), 46 deletions(-)
New commits: commit fabd928366522805888e487a1eb5725d7639f3af Author: Michael Meeks <[email protected]> AuthorDate: Thu Jul 26 09:23:05 2018 +0100 Commit: Michael Meeks <[email protected]> CommitDate: Thu Jul 26 09:23:37 2018 +0100 Mark LOOLWebSocket as deprecated, and dung it out a bit. Change-Id: I4e1daff8a10092b8845971375ce83e09b78354ea diff --git a/common/LOOLWebSocket.hpp b/common/LOOLWebSocket.hpp index 73660e968..848a7639b 100644 --- a/common/LOOLWebSocket.hpp +++ b/common/LOOLWebSocket.hpp @@ -20,6 +20,8 @@ #include <Protocol.hpp> #include <Log.hpp> +/// Deprecated: do not use ... replaced by net/Socket.hpp +/// /// WebSocket that is thread safe, and handles large frames transparently. /// Careful - sendFrame and receiveFrame are _not_ virtual, /// we need to make sure that we use LOOLWebSocket all over the place. @@ -32,69 +34,35 @@ private: std::mutex _mutexRead; std::mutex _mutexWrite; -#if ENABLE_DEBUG - static std::chrono::milliseconds getWebSocketDelay() - { - unsigned long baseDelay = 0; - unsigned long jitter = 0; - if (std::getenv("LOOL_WS_DELAY")) - { - baseDelay = std::stoul(std::getenv("LOOL_WS_DELAY")); - } - if (std::getenv("LOOL_WS_JITTER")) - { - jitter = std::stoul(std::getenv("LOOL_WS_JITTER")); - } - - return std::chrono::milliseconds(baseDelay + (jitter > 0 ? (std::rand() % jitter) : 0)); - } - - void setMinSocketBufferSize() - { - 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 - public: LOOLWebSocket(const Socket& socket) : Poco::Net::WebSocket(socket) { } +#if 0 LOOLWebSocket(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response) : Poco::Net::WebSocket(request, response) { -#if ENABLE_DEBUG - setMinSocketBufferSize(); -#endif } +#endif LOOLWebSocket(Poco::Net::HTTPClientSession& cs, Poco::Net::HTTPRequest& request, Poco::Net::HTTPResponse& response) : Poco::Net::WebSocket(cs, request, response) { -#if ENABLE_DEBUG - setMinSocketBufferSize(); -#endif } - +#if 0 LOOLWebSocket(Poco::Net::HTTPClientSession& cs, Poco::Net::HTTPRequest& request, Poco::Net::HTTPResponse& response, Poco::Net::HTTPCredentials& credentials) : Poco::Net::WebSocket(cs, request, response, credentials) { -#if ENABLE_DEBUG - setMinSocketBufferSize(); -#endif } +#endif /// Wrapper for Poco::Net::WebSocket::receiveFrame() that handles PING frames /// (by replying with a PONG frame) and PONG frames. PONG frames are ignored. @@ -105,10 +73,6 @@ public: /// Should we also factor out the handling of non-final and continuation frames into this? int receiveFrame(char* buffer, const int length, int& flags) { -#if ENABLE_DEBUG - // Delay receiving the frame - std::this_thread::sleep_for(getWebSocketDelay()); -#endif // Timeout is in microseconds. We don't need this, except to yield the cpu. static const Poco::Timespan waitTime(POLL_TIMEOUT_MS * 1000 / 10); static const Poco::Timespan waitZero(0); @@ -157,10 +121,6 @@ public: /// Wrapper for Poco::Net::WebSocket::sendFrame() that handles large frames. int sendFrame(const char* buffer, const int length, const int flags = FRAME_TEXT) { -#if ENABLE_DEBUG - // Delay sending the frame - std::this_thread::sleep_for(getWebSocketDelay()); -#endif static const Poco::Timespan waitZero(0); std::unique_lock<std::mutex> lock(_mutexWrite); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
