diff options
author | Ben Pfaff <blp@nicira.com> | 2012-11-19 15:55:54 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-11-20 15:01:03 -0800 |
commit | d6cedfd9d29df4f9e9b7575c03ffcd2d84588c62 (patch) | |
tree | 3c85401a8208bedb404d542c30dc87450dd6b70d /python | |
parent | c3f2538933e2a7663283158a8bf806bf66ac1a23 (diff) | |
download | openvswitch-d6cedfd9d29df4f9e9b7575c03ffcd2d84588c62.tar.gz |
socket-util: Avoid using SO_ERROR.
ESX doesn't implement it, and there's another approach that should work
everywhere, so drop back to that.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'python')
-rw-r--r-- | python/ovs/socket_util.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py index f54b9040a..e6b6fcef9 100644 --- a/python/ovs/socket_util.py +++ b/python/ovs/socket_util.py @@ -78,8 +78,22 @@ def make_unix_socket(style, nonblock, bind_path, connect_path): def check_connection_completion(sock): p = ovs.poller.SelectPoll() p.register(sock, ovs.poller.POLLOUT) - if len(p.poll(0)) == 1: - return get_socket_error(sock) + pfds = p.poll(0) + if len(pfds) == 1: + revents = pfds[0][1] + if revents & ovs.poller.POLLERR: + try: + # The following should raise an exception. + socket.send("\0", socket.MSG_DONTWAIT) + + # (Here's where we end up if it didn't.) + # XXX rate-limit + vlog.err("poll return POLLERR but send succeeded") + return errno.EPROTO + except socket.error, e: + return get_exception_errno(e) + else: + return 0 else: return errno.EAGAIN |