2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

python: Catch exception "SSL.SysCallError" for send by SSL.

When OVSDB server is aborted,
the SSL send function will throw SSL.SysCallError exception,
which we need to catch and return it's -errno.

While SSL.WantWriteError exception needs to return -EAGAIN
based on its parent class, not EAGAIN

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Guoshuai Li
2017-01-07 14:28:35 +08:00
committed by Ben Pfaff
parent 94783c7cfb
commit 871a38766b

View File

@@ -809,7 +809,9 @@ class SSLStream(Stream):
buf = buf.encode('utf-8')
return super(SSLStream, self).send(buf)
except SSL.WantWriteError:
return errno.EAGAIN
return -errno.EAGAIN
except SSL.SysCallError as e:
return -ovs.socket_util.get_exception_errno(e)
if SSL: