Compare commits

...

2 Commits

Author SHA1 Message Date
Stefan Meinecke
11029ce67a
Merge 8310b16895fd36d1e0e58b7fdb9aa34fea064e5b into 7e95ea7403449be2da65eaf7f41bd81d29e93274 2026-04-15 21:19:04 +02:00
Stefan Meinecke
8310b16895 Keep unauthenticated WebSocket alive during daemon receive loop
The unauthenticated (sealed sender) socket had no keep-alive token
registered, causing SignalWebSocket's DelayedDisconnectThread to tear
down the connection ~10s after each send. Every subsequent group message
then had to re-establish a fresh TLS connection (~6s delay).

The authenticated socket avoids this by registering a "receive" keep-alive
token for the lifetime of the receive loop. Apply the same pattern to the
unauthenticated socket: register the token alongside the authenticated one
and remove it in the same finally block.

This keeps the unidentified connection alive in daemon mode, matching the
behaviour of Signal mobile clients.
2026-04-14 19:59:42 +02:00

View File

@ -102,6 +102,9 @@ public class ReceiveHelper {
signalWebSocket.connect();
signalWebSocket.registerKeepAliveToken("receive");
final var unauthenticatedSignalWebSocket = dependencies.getUnauthenticatedSignalWebSocket();
unauthenticatedSignalWebSocket.registerKeepAliveToken("receive");
try {
receiveMessagesInternal(signalWebSocket, timeout, maxMessages, handler, queuedActions);
} finally {
@ -110,6 +113,7 @@ public class ReceiveHelper {
queuedActions.clear();
signalWebSocket.removeKeepAliveToken("receive");
signalWebSocket.disconnect();
unauthenticatedSignalWebSocket.removeKeepAliveToken("receive");
webSocketStateDisposable.dispose();
shouldStop = false;
}