[ovs-dev] [PATCH] Shutdown SSL connection before closing socket

Terry Wilson twilson at redhat.com
Wed Jul 10 16:07:16 UTC 2019

Without shutting down the SSL connection, log messages like:

stream_ssl|WARN|SSL_read: unexpected SSL connection close
jsonrpc|WARN|ssl: receive error: Protocol error
reconnect|WARN|ssl: connection dropped (Protocol error)

would occur whenever the socket is closed. This just adds an
SSLStream.close() that calls shutdown() and ignores read/write

Signed-off-by: Terry Wilson <twilson at redhat.com>
 python/ovs/stream.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index c15be4b..fd1045e 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -825,6 +825,14 @@ class SSLStream(Stream):
         except SSL.SysCallError as e:
             return -ovs.socket_util.get_exception_errno(e)
+    def close(self):
+        if self.socket:
+            try:
+                self.socket.shutdown()
+            except (SSL.WantReadError, SSL.WantWriteError):
+                pass
+        return super(SSLStream, self).close()
 if SSL:
     # Register SSL only if the OpenSSL module is available

More information about the dev mailing list