X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fsocket_util.py;fp=python%2Fovs%2Fsocket_util.py;h=e6b6fcef9c2a486cffd240d9af04427f6cfbb693;hb=d6cedfd9d29df4f9e9b7575c03ffcd2d84588c62;hp=f54b9040ae051da61d6382d8fdda29152075ef6e;hpb=c3f2538933e2a7663283158a8bf806bf66ac1a23;p=openvswitch diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py index f54b9040..e6b6fcef 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