This commit is contained in:
2020-08-29 14:00:37 +02:00
parent e27318f49d
commit f34d1a1a38

View File

@@ -487,22 +487,22 @@ class NetFH(Thread):
HEADER_START, b'DA', self.__position, length, HEADER_STOP
))
self.__position += length
buffer.clear()
net_buffer = b''
while length > 0:
count = self._slavesock.recv_into(
self.__buff_block,
min(length, self.__buff_size),
)
if count == 0:
# Add missing bytes with zero to restore original size
buffer += bytearray(length)
self.__sockerr.set()
raise IOError("read error on network")
buffer += self.__buff_block[:count]
net_buffer += self.__buff_block[:count]
length -= count
# We received the correct amount of bytes here
self.__position += length
buffer[:] = net_buffer
return len(buffer)
def readpictory(self) -> bytes: