common/LOOLWebSocket.hpp | 29 ----------------------------- 1 file changed, 29 deletions(-)
New commits: commit f978982a7acad4ac2cc9e67595321a1fe99e8729 Author: Michael Meeks <[email protected]> AuthorDate: Tue Mar 24 10:26:46 2020 +0000 Commit: Michael Meeks <[email protected]> CommitDate: Tue Mar 24 12:18:48 2020 +0100 cleanup: remove obsolete locking & dead code from LOOLWebSocket. LOOLWebSocket is used only for tests and a few tools anyway. Change-Id: I18e04efc2fb3a4cc075f7cefa4ebd0d10fbdb3df Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90974 Tested-by: Michael Meeks <[email protected]> Reviewed-by: Michael Meeks <[email protected]> diff --git a/common/LOOLWebSocket.hpp b/common/LOOLWebSocket.hpp index 848a7639b..6d3bd42cf 100644 --- a/common/LOOLWebSocket.hpp +++ b/common/LOOLWebSocket.hpp @@ -30,39 +30,18 @@ /// larger code changes. class LOOLWebSocket : public Poco::Net::WebSocket { -private: - std::mutex _mutexRead; - std::mutex _mutexWrite; - 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) - { - } -#endif - LOOLWebSocket(Poco::Net::HTTPClientSession& cs, Poco::Net::HTTPRequest& request, Poco::Net::HTTPResponse& response) : Poco::Net::WebSocket(cs, request, response) { } -#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) - { - } -#endif /// Wrapper for Poco::Net::WebSocket::receiveFrame() that handles PING frames /// (by replying with a PONG frame) and PONG frames. PONG frames are ignored. @@ -79,9 +58,7 @@ public: while (poll(waitTime, Poco::Net::Socket::SELECT_READ)) { - std::unique_lock<std::mutex> lockRead(_mutexRead); const int n = Poco::Net::WebSocket::receiveFrame(buffer, length, flags); - lockRead.unlock(); if (n <= 0) LOG_TRC("Got nothing (" << n << ")"); @@ -97,7 +74,6 @@ public: if ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING) { // Echo back the ping message. - std::unique_lock<std::mutex> lock(_mutexWrite); if (Poco::Net::WebSocket::sendFrame(buffer, n, static_cast<int>(WebSocket::FRAME_FLAG_FIN) | WebSocket::FRAME_OP_PONG) != n) { LOG_WRN("Sending Pong failed."); @@ -122,12 +98,9 @@ public: int sendFrame(const char* buffer, const int length, const int flags = FRAME_TEXT) { static const Poco::Timespan waitZero(0); - std::unique_lock<std::mutex> lock(_mutexWrite); const int result = Poco::Net::WebSocket::sendFrame(buffer, length, flags); - lock.unlock(); - if (result != length) { LOG_ERR("Sent incomplete message, expected " << length << " bytes but sent " << result << @@ -152,8 +125,6 @@ public: /// or, otherwise, close the socket without sending close frame, if it is. void shutdown(Poco::UInt16 statusCode, const std::string& statusMessage = "") { - std::unique_lock<std::mutex> lockRead(_mutexRead); - std::unique_lock<std::mutex> lockWrite(_mutexWrite); try { // Calling shutdown, in case of error, would try to send a 'close' frame _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
