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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Mar 26 05:09:04 UTC 2017


 net/WebSocketHandler.hpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c1ffb649048f6735a5804a8febc8689b52b28596
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Mar 25 21:51:25 2017 -0400

    wsd: correct shutdown status code echoed back
    
    Change-Id: Ieb685135ab280ed76070af3392bfa69cf313f35a
    Reviewed-on: https://gerrit.libreoffice.org/35708
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 08500bf2..6983fbae 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -213,8 +213,10 @@ public:
             if (!_shuttingDown)
             {
                 // Peer-initiated shutdown must be echoed.
-                // Otherwise, this is the echo to _out_ shutdown message.
-                const StatusCodes statusCode = static_cast<StatusCodes>((static_cast<unsigned>(_wsPayload[0]) << 8) | _wsPayload[1]);
+                // Otherwise, this is the echo to _our_ shutdown message, which we should ignore.
+                const StatusCodes statusCode = static_cast<StatusCodes>((((uint64_t)(unsigned char)_wsPayload[0]) << 8) +
+                                                                        (((uint64_t)(unsigned char)_wsPayload[1]) << 0));
+                LOG_TRC("#" << socket->getFD() << ": Client initiated socket shutdown. Code: " << static_cast<int>(statusCode));
                 if (_wsPayload.size() > 2)
                 {
                     const std::string message(&_wsPayload[2], &_wsPayload[2] + _wsPayload.size() - 2);


More information about the Libreoffice-commits mailing list