mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
Bug fix for NetIO with autorefresh=True
This commit is contained in:
@@ -21,7 +21,7 @@ __author__ = "Sven Sager <akira@revpimodio.org>"
|
|||||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
__license__ = "LGPLv3"
|
__license__ = "LGPLv3"
|
||||||
__name__ = "revpimodio2"
|
__name__ = "revpimodio2"
|
||||||
__version__ = "2.5.0"
|
__version__ = "2.5.1"
|
||||||
|
|
||||||
# Global package values
|
# Global package values
|
||||||
OFF = 0
|
OFF = 0
|
||||||
|
|||||||
@@ -463,6 +463,42 @@ class NetFH(Thread):
|
|||||||
|
|
||||||
return bytes(self.__buff_recv)
|
return bytes(self.__buff_recv)
|
||||||
|
|
||||||
|
def readinto(self, buffer: bytearray) -> int:
|
||||||
|
"""
|
||||||
|
Read data from network into a buffer.
|
||||||
|
|
||||||
|
:param buffer: Use Buffer to write bytes into
|
||||||
|
:return: Amount of read bytes
|
||||||
|
"""
|
||||||
|
if self.__config_changed:
|
||||||
|
raise ConfigChanged("configuration on revolution pi was changed")
|
||||||
|
if self.__sockend.is_set():
|
||||||
|
raise ValueError("read of closed file")
|
||||||
|
|
||||||
|
length = len(buffer)
|
||||||
|
with self.__socklock:
|
||||||
|
# b CM ii ii 00000000 b = 16
|
||||||
|
self._slavesock.sendall(pack(
|
||||||
|
"=c2sHH8xc",
|
||||||
|
HEADER_START, b'DA', self.__position, length, HEADER_STOP
|
||||||
|
))
|
||||||
|
|
||||||
|
self.__position += length
|
||||||
|
|
||||||
|
buffer.clear()
|
||||||
|
while length > 0:
|
||||||
|
count = self._slavesock.recv_into(
|
||||||
|
self.__buff_block,
|
||||||
|
min(length, self.__buff_size),
|
||||||
|
)
|
||||||
|
if count == 0:
|
||||||
|
self.__sockerr.set()
|
||||||
|
raise IOError("read error on network")
|
||||||
|
buffer += self.__buff_block[:count]
|
||||||
|
length -= count
|
||||||
|
|
||||||
|
return len(buffer)
|
||||||
|
|
||||||
def readpictory(self) -> bytes:
|
def readpictory(self) -> bytes:
|
||||||
"""
|
"""
|
||||||
Ruft die piCtory Konfiguration ab.
|
Ruft die piCtory Konfiguration ab.
|
||||||
|
|||||||
Reference in New Issue
Block a user