summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan.hoffmann@cloudandheat.com>2023-04-21 10:29:36 +0200
committerIlya Maximets <i.maximets@ovn.org>2023-04-26 14:56:35 +0200
commit0136ccd060e9a9f79d22623ab41f715a5f761505 (patch)
treea545523cace5931cce0362c2b368aab6d0e72d66
parent385f79c87e944575759f1d3e611c9dbb92b3c57b (diff)
downloadopenvswitch-0136ccd060e9a9f79d22623ab41f715a5f761505.tar.gz
python-stream: Handle SSL error in do_handshake.
In some cases ovsdb server or relay gets restarted, ovsdb python clients may keep the local socket open. Instead of reconnecting a lot of failures will be logged. This can be reproduced with ssl connections to the server/relay and restarting it, so it has the same IP after restart. This patch catches the Exceptions at do_handshake to recreate the connection on the client side. Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Stefan Hoffmann <stefan.hoffmann@cloudandheat.com> Signed-off-by: Luca Czesla <luca.czesla@mail.schwarz> Signed-off-by: Max Lamprecht <max.lamprecht@mail.schwarz> Co-authored-by: Luca Czesla <luca.czesla@mail.schwarz> Co-authored-by: Max Lamprecht <max.lamprecht@mail.schwarz> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--python/ovs/stream.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index ac5b0fd0c..b32341076 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -824,7 +824,8 @@ class SSLStream(Stream):
self.socket.do_handshake()
except ssl.SSLWantReadError:
return errno.EAGAIN
- except ssl.SSLSyscallError as e:
+ except (ssl.SSLSyscallError, ssl.SSLZeroReturnError,
+ ssl.SSLEOFError, OSError) as e:
return ovs.socket_util.get_exception_errno(e)
return 0