diff options
-rw-r--r-- | lib/py/src/transport/TSocket.py | 3 | ||||
-rw-r--r-- | lib/py/test/test_socket.py | 1 | ||||
-rw-r--r-- | lib/py/test/test_sslsocket.py | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py index 3c7a3ca7d..eea5366c7 100644 --- a/lib/py/src/transport/TSocket.py +++ b/lib/py/src/transport/TSocket.py @@ -94,6 +94,9 @@ class TSocket(TSocketBase): if exc.errno in (errno.EWOULDBLOCK, errno.EAGAIN): return True return False + except ValueError: + # SSLSocket fails on recv with non-zero flags; fallback to the old behavior + return True finally: self.handle.settimeout(original_timeout) diff --git a/lib/py/test/test_socket.py b/lib/py/test/test_socket.py index 95124dcbe..b732653a4 100644 --- a/lib/py/test/test_socket.py +++ b/lib/py/test/test_socket.py @@ -25,6 +25,7 @@ class TSocketTest(unittest.TestCase): acc.start() sock = TSocket(host="localhost", port=acc.port) + self.assertFalse(sock.isOpen()) sock.open() sock.setTimeout(timeout) diff --git a/lib/py/test/test_sslsocket.py b/lib/py/test/test_sslsocket.py index f4c87f195..3b77e391b 100644 --- a/lib/py/test/test_sslsocket.py +++ b/lib/py/test/test_sslsocket.py @@ -158,7 +158,9 @@ class TSSLSocketTest(unittest.TestCase): def _assert_connection_success(self, server, path=None, **client_args): with self._connectable_client(server, path=path, **client_args) as (acc, client): try: + self.assertFalse(client.isOpen()) client.open() + self.assertTrue(client.isOpen()) client.write(b"hello") self.assertEqual(client.read(5), b"there") self.assertTrue(acc.client is not None) |