Skip to content

Commit

Permalink
Shutdown SSL connection before closing socket
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
otherwiseguy authored and blp committed Jul 12, 2019
1 parent 03b7563 commit 5fe1799
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/ovs/stream.py
Expand Up @@ -825,6 +825,14 @@ def send(self, buf):
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
Expand Down

0 comments on commit 5fe1799

Please sign in to comment.