[ovs-dev] [PATCH] python: Report POLLHUP as an error while connection completion checking.
Ilya Maximets
i.maximets at samsung.com
Thu Dec 20 17:36:39 UTC 2018
Otherwise failed non-blocking connection reported as connected.
This causes errors in all following operations with the socket.
For example, ovsdb-idl tests fails with the following error trying
to send data to the 'WRONG_PORT_1':
stderr:
jsonrpc transaction failed: Broken pipe
This happens because dispite of SelectPoll, select.poll could
return POLLHUP without POLLERR set.
This fixes tests on FreeBSD.
CC: Numan Siddique <nusiddiq at redhat.com>
Fixes: c1aa16d191d2 ("ovs python: ovs.stream.open_block() returns success even if the remote is unreachable")
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---
python/ovs/socket_util.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
index 8e582fe91..2596ddefd 100644
--- a/python/ovs/socket_util.py
+++ b/python/ovs/socket_util.py
@@ -178,7 +178,7 @@ def check_connection_completion(sock):
pfds = p.poll(0)
if len(pfds) == 1:
revents = pfds[0][1]
- if revents & ovs.poller.POLLERR:
+ if revents & ovs.poller.POLLERR or revents & ovs.poller.POLLHUP:
try:
# The following should raise an exception.
sock.send("\0".encode(), socket.MSG_DONTWAIT)
--
2.17.1
More information about the dev
mailing list