diff options
author | Joffrey F <f.joffrey@gmail.com> | 2016-11-28 14:00:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 14:00:32 -0800 |
commit | 52376e4b2453576c424d57a5c662e811c8a6d577 (patch) | |
tree | 9d415a45fd1fe4234739dc0c8c417c56282da6c7 | |
parent | 9643253c50aacc57ec66453137599ddeeee10d84 (diff) | |
parent | dbd704e68daa16fb91fa2228a9cc2a58219eeec3 (diff) | |
download | docker-py-52376e4b2453576c424d57a5c662e811c8a6d577.tar.gz |
Merge pull request #1250 from mmerickel/fix/1211
do not assume that read will consume the number of bytes requested
-rw-r--r-- | docker/utils/socket.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/docker/utils/socket.py b/docker/utils/socket.py index 164b845..4080f25 100644 --- a/docker/utils/socket.py +++ b/docker/utils/socket.py @@ -69,7 +69,11 @@ def frames_iter(socket): """ Returns a generator of frames read from socket """ - n = next_frame_size(socket) - while n > 0: - yield read(socket, n) + while True: n = next_frame_size(socket) + if n == 0: + break + while n > 0: + result = read(socket, n) + n -= len(result) + yield result |