Fix satellite heartbeat timeout cleanup and /status blocking

Heartbeat timeout called m_con->disconnect() on a server-managed
connection, which didn't trigger TcpServer::clientDisconnected —
leaving dead satellites in the map forever. After timeout, the
unsigned rx counter wrapped to UINT_MAX preventing re-detection.
The timer also kept firing sendMsg() to the dead socket, blocking
the event loop and causing /status to stall for ~10s.

Fix: SatelliteLink emits linkFailed signal instead of calling
disconnect directly. Reflector handles cleanup via a deferred
zero-timer to avoid re-entrancy. The /status handler skips
satellites pending cleanup. Also disable ALSA in Docker build
(unused by the reflector).
This commit is contained in:
Audric committed 2026-03-20 19:08:31 +01:00
1 parent 195be03036
commit fa57db6e62
5 files changed
+72 -5

No files matched your search

+4
View File
@@ -306,6 +306,8 @@ class Reflector : public sigc::trackable
FramedTcpServer* m_sat_srv = nullptr;
std::string m_satellite_secret;
std::map<Async::FramedTcpConnection*, SatelliteLink*> m_satellite_con_map;
std::vector<SatelliteLink*> m_sat_cleanup_pending;
Async::Timer m_sat_cleanup_timer;
Reflector(const Reflector&);
Reflector& operator=(const Reflector&);
@@ -334,6 +336,8 @@ class Reflector : public sigc::trackable
void satelliteConnected(Async::FramedTcpConnection* con);
void satelliteDisconnected(Async::FramedTcpConnection* con,
Async::FramedTcpConnection::DisconnectReason reason);
void onSatelliteLinkFailed(SatelliteLink* link);
void processSatelliteCleanup(Async::Timer* t);
bool loadCertificateFiles(void);
bool loadServerCertificateFiles(void);
bool generateKeyFile(Async::SslKeypair& pkey, const std::string& keyfile);