[yamahareceiver] Fix read stall blocking OH thing handler thread pool (#17769)

Since no read timeout was set, reads blocked indefinitely, which in case
of unreachable receiver led to blocking the OH thing handler thread
pool, since multiple requests are launched into the thread pool
simultaneously.

Fixes #17768

Signed-off-by: Danny Baumann <dannybaumann@web.de>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
maniac103 2024-11-19 20:08:13 +01:00 committed by Ciprian Pascu
parent 2fc5ffecf3
commit ed1dc963d0

View File

@ -47,6 +47,7 @@ public class XMLConnection extends AbstractConnection {
private static final String HEADER_CHARSET_PART = "charset=";
private static final int CONNECTION_TIMEOUT_MS = 5000;
private static final int READ_TIMEOUT_MS = 3000;
public XMLConnection(String host) {
super(host);
@ -77,6 +78,7 @@ public class XMLConnection extends AbstractConnection {
// Set a timeout in case the device is not reachable (went offline)
connection.setConnectTimeout(CONNECTION_TIMEOUT_MS);
connection.setReadTimeout(READ_TIMEOUT_MS);
connection.setUseCaches(false);
connection.setDoInput(true);