Skip to content

Commit 37fbc8b

Browse files
committed
Do not interrupt streaming when encountering 0-length frames
Signed-off-by: Joffrey F <[email protected]>
1 parent 2671d87 commit 37fbc8b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docker/utils/socket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def next_frame_size(socket):
5959
try:
6060
data = read_exactly(socket, 8)
6161
except SocketError:
62-
return 0
62+
return -1
6363

6464
_, actual = struct.unpack('>BxxxL', data)
6565
return actual
@@ -71,7 +71,7 @@ def frames_iter(socket):
7171
"""
7272
while True:
7373
n = next_frame_size(socket)
74-
if n == 0:
74+
if n < 0:
7575
break
7676
while n > 0:
7777
result = read(socket, n)

tests/unit/fake_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def get_fake_wait():
205205

206206
def get_fake_logs():
207207
status_code = 200
208-
response = (b'\x01\x00\x00\x00\x00\x00\x00\x11Flowering Nights\n'
208+
response = (b'\x01\x00\x00\x00\x00\x00\x00\x00'
209+
b'\x02\x00\x00\x00\x00\x00\x00\x00'
210+
b'\x01\x00\x00\x00\x00\x00\x00\x11Flowering Nights\n'
209211
b'\x01\x00\x00\x00\x00\x00\x00\x10(Sakuya Iyazoi)\n')
210212
return status_code, response
211213

0 commit comments

Comments
 (0)