mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
Restore fix c20caaa5d5
This commit is contained in:
@@ -487,22 +487,22 @@ class NetFH(Thread):
|
|||||||
HEADER_START, b'DA', self.__position, length, HEADER_STOP
|
HEADER_START, b'DA', self.__position, length, HEADER_STOP
|
||||||
))
|
))
|
||||||
|
|
||||||
self.__position += length
|
net_buffer = b''
|
||||||
|
|
||||||
buffer.clear()
|
|
||||||
while length > 0:
|
while length > 0:
|
||||||
count = self._slavesock.recv_into(
|
count = self._slavesock.recv_into(
|
||||||
self.__buff_block,
|
self.__buff_block,
|
||||||
min(length, self.__buff_size),
|
min(length, self.__buff_size),
|
||||||
)
|
)
|
||||||
if count == 0:
|
if count == 0:
|
||||||
# Add missing bytes with zero to restore original size
|
|
||||||
buffer += bytearray(length)
|
|
||||||
self.__sockerr.set()
|
self.__sockerr.set()
|
||||||
raise IOError("read error on network")
|
raise IOError("read error on network")
|
||||||
buffer += self.__buff_block[:count]
|
net_buffer += self.__buff_block[:count]
|
||||||
length -= count
|
length -= count
|
||||||
|
|
||||||
|
# We received the correct amount of bytes here
|
||||||
|
self.__position += length
|
||||||
|
buffer[:] = net_buffer
|
||||||
|
|
||||||
return len(buffer)
|
return len(buffer)
|
||||||
|
|
||||||
def readpictory(self) -> bytes:
|
def readpictory(self) -> bytes:
|
||||||
|
|||||||
Reference in New Issue
Block a user