]> git.proxmox.com Git - mirror_ovs.git/commitdiff
Shutdown SSL connection before closing socket
authorTerry Wilson <twilson@redhat.com>
Thu, 11 Jul 2019 13:00:20 +0000 (08:00 -0500)
committerBen Pfaff <blp@ovn.org>
Fri, 12 Jul 2019 17:36:50 +0000 (10:36 -0700)
Without shutting down the SSL connection, log messages like:

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

would occur whenever the socket is closed. This just adds an
SSLStream.close() that calls shutdown() and ignores SSL errors, the
same way that lib/stream-ssl.c does in ssl_close().

Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
python/ovs/stream.py

index c15be4b3e53cbc3c5908306d495e907cdf9c2dc2..a98057e42a13aebfa58eaec03daa267dcb3f6258 100644 (file)
@@ -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.Error:
+                pass
+        return super(SSLStream, self).close()
+
 
 if SSL:
     # Register SSL only if the OpenSSL module is available