timeout to prevent blocked process due to serial interface not receiving any data

This commit is contained in:
Aaska Black Wolf
2026-06-04 13:07:31 +02:00
parent 264c4d3b10
commit d7df607f92
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -105,7 +105,8 @@
$bytesToRead = $config->bytesToRead;
writeLog("Reading $bytesToRead Byte from VE.Direct interface\r\n", 3);
$dataStream = "";
while(strlen($dataStream) < $bytesToRead)
$startTime = time();
while(strlen($dataStream) < $bytesToRead && time() < $startTime + $config->timeout)
$dataStream .= dio_read($VEinterface, $bytesToRead);
dio_close($VEinterface);
writeLog($dataStream . "\r\n\r\n", 4);