[Libreoffice-commits] online.git: loolwsd/ClientSession.cpp loolwsd/ClientSession.hpp loolwsd/LOOLWSD.cpp loolwsd/PrisonerSession.cpp loolwsd/PrisonerSession.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Nov 14 05:28:48 UTC 2016


 loolwsd/ClientSession.cpp   |   11 -----------
 loolwsd/ClientSession.hpp   |    2 --
 loolwsd/LOOLWSD.cpp         |   12 +++---------
 loolwsd/PrisonerSession.cpp |   11 -----------
 loolwsd/PrisonerSession.hpp |    2 --
 5 files changed, 3 insertions(+), 35 deletions(-)

New commits:
commit 7b87e4ab7831894a67c106771fc389f259784422
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Nov 13 12:33:16 2016 -0500

    loolwsd: kill superfluous shutdownPeer
    
    Change-Id: I50880e15b5e36f7701bafbfa59be57ed6bd856c1
    Reviewed-on: https://gerrit.libreoffice.org/30824
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index 2ab3e7a..93d68df 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -383,17 +383,6 @@ bool ClientSession::sendCombinedTiles(const char* /*buffer*/, int /*length*/, St
     return true;
 }
 
-bool ClientSession::shutdownPeer(Poco::UInt16 statusCode)
-{
-    if (_peer && !_peer->isCloseFrame())
-    {
-        _peer->shutdown(statusCode);
-        return true;
-    }
-
-    return false;
-}
-
 bool ClientSession::forwardToChild(const std::string& message,
                                    const std::shared_ptr<DocumentBroker>& docBroker)
 {
diff --git a/loolwsd/ClientSession.hpp b/loolwsd/ClientSession.hpp
index ae41b63..7b7740c 100644
--- a/loolwsd/ClientSession.hpp
+++ b/loolwsd/ClientSession.hpp
@@ -36,10 +36,8 @@ public:
     /// Create and connect Prisoner Session between DocumentBroker and us.
     void bridgePrisonerSession();
     std::shared_ptr<PrisonerSession> getPeer() const { return _peer; }
-    bool shutdownPeer(Poco::UInt16 statusCode);
 
     const std::string getUserId() const { return _userId; }
-
     void setUserId(const std::string& userId) { _userId = userId; }
     void setUserName(const std::string& userName) { _userName = userName; }
     void setDocumentOwner(const bool isDocumentOwner) { _isDocumentOwner = isDocumentOwner; }
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 507c1a4..177b155 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -579,8 +579,6 @@ private:
                     {
                         LOG_ERR("Multiple sessions during conversion. " << sessionsCount << " sessions remain.");
                     }
-
-                    session->shutdownPeer(WebSocket::WS_NORMAL_CLOSE);
                 }
 
                 // Clean up the temporary directory the HTMLForm ctor created.
@@ -970,12 +968,9 @@ private:
         if (session->isCloseFrame())
         {
             LOG_TRC("Normal close handshake.");
-            if (session->shutdownPeer(WebSocket::WS_NORMAL_CLOSE))
-            {
-                // Client initiated close handshake
-                // respond close frame
-                ws->shutdown();
-            }
+            // Client initiated close handshake
+            // respond close frame
+            ws->shutdown();
         }
         else
         {
@@ -984,7 +979,6 @@ private:
             session->closeFrame();
             // FIXME: handle exception thrown from here ? ...
             ws->shutdown(WebSocket::WS_ENDPOINT_GOING_AWAY);
-            session->shutdownPeer(WebSocket::WS_ENDPOINT_GOING_AWAY);
         }
 
         LOG_INF("Finished GET request handler for session [" << id << "].");
diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index 8696992..a7cfa3a 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -258,15 +258,4 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
     return true;
 }
 
-bool PrisonerSession::shutdownPeer(Poco::UInt16 statusCode)
-{
-    auto peer = _peer.lock();
-    if (peer && !peer->isCloseFrame())
-    {
-        peer->shutdown(statusCode);
-    }
-
-    return peer != nullptr;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/PrisonerSession.hpp b/loolwsd/PrisonerSession.hpp
index 55a3de5..a52dfc8 100644
--- a/loolwsd/PrisonerSession.hpp
+++ b/loolwsd/PrisonerSession.hpp
@@ -26,8 +26,6 @@ public:
 
     virtual ~PrisonerSession();
 
-    bool shutdownPeer(Poco::UInt16 statusCode);
-
 private:
     /// Handle messages from the Kit to the client.
     virtual bool _handleInput(const char* buffer, int length) override;


More information about the Libreoffice-commits mailing list