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 --git a/python/ovs/stream.py b/python/ovs/stream.py
index b43e105..68dffbc 100644
--- a/python/ovs/stream.py
+++ b/python/ovs/stream.py
@@ -451,6 +451,8 @@ class SSLStream(Stream):
             self.socket.do_handshake()
         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 as e:
+            return (0, "")
 
     def send(self, buf):
         try:
-- 
2.10.1.windows.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to