Skip to content

Commit

Permalink
python: Catch exception "SSL.SysCallError" for send by SSL.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Guoshuai Li authored and blp committed Jan 14, 2017
1 parent 94783c7 commit 871a387
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/ovs/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,9 @@ def send(self, buf):
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:
Expand Down

0 comments on commit 871a387

Please sign in to comment.