mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-20 13:34:23 +00:00
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.
This commit is contained in:
parent
4601e60118
commit
97f77b1f69
@ -101,6 +101,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 {
|
||||
@ -109,6 +112,7 @@ public class ReceiveHelper {
|
||||
queuedActions.clear();
|
||||
signalWebSocket.removeKeepAliveToken("receive");
|
||||
signalWebSocket.disconnect();
|
||||
unauthenticatedSignalWebSocket.removeKeepAliveToken("receive");
|
||||
webSocketStateDisposable.dispose();
|
||||
shouldStop = false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user