From 05af7256bbdf154a697c3d878454becc84c41bd3 Mon Sep 17 00:00:00 2001 From: hobbyquaker Date: Tue, 13 Oct 2026 11:10:38 +0200 Subject: [PATCH] libhsscomm: bound the asynchronous callbacks with a timeout AsyncXmlRpcSender sends newDevices, deleteDevices, replaceDevice, updateDevice and the service events from a detached thread per call, with an XmlRpcClient that has no timeout. A receiver that accepts the call and never answers keeps that thread and its socket alive for as long as it keeps the connection open, and every further init or device change adds another one - rfd and hs485d grow by a thread and a socket each time until they run out of either. Give the client a 30 s timeout: a timed-out call takes the existing transport error path, the thread logs it and ends. The result of these calls is never used beyond the log line, so a receiver that is merely slow loses nothing but gets an error line in the log; 30 s keeps that away from any healthy receiver. Fixes #171 --- src/libhsscomm/AsyncXmlRpcSender.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libhsscomm/AsyncXmlRpcSender.cpp b/src/libhsscomm/AsyncXmlRpcSender.cpp index a49ebf7a9..fa16f402a 100644 --- a/src/libhsscomm/AsyncXmlRpcSender.cpp +++ b/src/libhsscomm/AsyncXmlRpcSender.cpp @@ -15,6 +15,7 @@ using namespace XmlRpc; AsyncXmlRpcSender::AsyncXmlRpcSender(const std::string& url):c(url) { + c.setTimeout(30000); // a receiver that does not answer must not keep the thread and its socket for ever } AsyncXmlRpcSender::~AsyncXmlRpcSender(void)