diff mbox

[ovs-dev,V2] python: Fix The SSL connection is not reconnected when the OVSDB Server is restarted

Message ID 20161204120229.2860-1-ligs@dtdream.com
State Accepted
Headers show

Commit Message

Guoshuai Li Dec. 4, 2016, 12:02 p.m. UTC
When the SSL connection is disconnected by the peer
the client's do_handshake() function throws the exception OpenSSL.SSL.SysCallError
we need to catch the exception and return the exception errno so that the SSL connection can be reconnected.
And the recv() function throws the exception OpenSSL.SSL.ZeroReturnError
This exception refers to TCP connection normal closed, return (0, "")
 python/ovs/stream.py | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox


diff --git a/python/ovs/stream.py b/python/ovs/stream.py
index b43e105..abb1b8e 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -451,6 +451,8 @@  class SSLStream(Stream):
         except SSL.WantReadError:
             return errno.EAGAIN
+        except SSL.SysCallError as e:
+            return ovs.socket_util.get_exception_errno(e)
         return 0
@@ -459,6 +461,8 @@  class SSLStream(Stream):
             return super(SSLStream, self).recv(n)
         except SSL.WantReadError:
             return (errno.EAGAIN, "")
+        except SSL.ZeroReturnError:
+            return (0, "")
     def send(self, buf):