diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-02 18:03:33 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-02 18:03:33 +0300 |
commit | 1cfd329b3d2746e73432e8007d429e565c6b5fa0 (patch) | |
tree | c797f86b1b9cf358dc66f5c74dff78bf9b54bd1f /test/unit | |
parent | 790b4f8f00285ba005816239cb242e953d60db69 (diff) | |
download | unit-1cfd329b3d2746e73432e8007d429e565c6b5fa0.tar.gz unit-1cfd329b3d2746e73432e8007d429e565c6b5fa0.tar.bz2 |
Tests: fixed recv_bytes() in websockets.py.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/applications/websockets.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/test/unit/applications/websockets.py b/test/unit/applications/websockets.py index 3553af6e..5f9c3c51 100644 --- a/test/unit/applications/websockets.py +++ b/test/unit/applications/websockets.py @@ -61,15 +61,9 @@ class TestApplicationWebsocket(TestApplicationProto): def recv_bytes(sock, bytes): data = b'' while select.select([sock], [], [], read_timeout)[0]: - try: - if bytes < 65536: - data = sock.recv(bytes) - else: - data = self.recvall( - sock, read_timeout=read_timeout, buff_size=bytes - ) - break - except: + data += sock.recv(bytes - len(data)) + + if len(data) == bytes: break return data |