[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/socket.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Feb 20 04:39:40 UTC 2017


 net/socket.hpp |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit cbfa42e24828a16eabf605c973cbe357be355c95
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Feb 19 23:22:39 2017 -0500

    nb: properly shutdown and cleanup SSL
    
    Change-Id: Idd39851775e16c62d6192e08c9058cd9fb40104f
    Reviewed-on: https://gerrit.libreoffice.org/34454
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/net/socket.hpp b/net/socket.hpp
index 3119834..25a335c 100644
--- a/net/socket.hpp
+++ b/net/socket.hpp
@@ -431,6 +431,22 @@ protected:
 class SslStreamSocket : public BufferingSocket
 {
 public:
+    ~SslStreamSocket()
+    {
+        shutdown();
+        SSL_free(_ssl);
+    }
+
+    /// Shutdown the TLS/SSL connection properly.
+    void shutdown()
+    {
+        if (SSL_shutdown(_ssl) == 0)
+        {
+            // Complete the bidirectional shutdown.
+            SSL_shutdown(_ssl);
+        }
+    }
+
     bool readIncomingData() override
     {
         const int rc = doHandshake();


More information about the Libreoffice-commits mailing list