mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Disconnect websocket when receiving is done
This commit is contained in:
parent
9c86baf0ea
commit
2b0989adfe
1 changed files with 4 additions and 0 deletions
|
@ -920,6 +920,7 @@ public class ManagerImpl implements Manager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
receiveThread = new Thread(() -> {
|
receiveThread = new Thread(() -> {
|
||||||
|
logger.debug("Starting receiving messages");
|
||||||
while (!Thread.interrupted()) {
|
while (!Thread.interrupted()) {
|
||||||
try {
|
try {
|
||||||
receiveMessagesInternal(1L, TimeUnit.HOURS, false, (envelope, e) -> {
|
receiveMessagesInternal(1L, TimeUnit.HOURS, false, (envelope, e) -> {
|
||||||
|
@ -938,12 +939,14 @@ public class ManagerImpl implements Manager {
|
||||||
logger.warn("Receiving messages failed, retrying", e);
|
logger.warn("Receiving messages failed, retrying", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.debug("Finished receiving messages");
|
||||||
hasCaughtUpWithOldMessages = false;
|
hasCaughtUpWithOldMessages = false;
|
||||||
synchronized (messageHandlers) {
|
synchronized (messageHandlers) {
|
||||||
receiveThread = null;
|
receiveThread = null;
|
||||||
|
|
||||||
// Check if in the meantime another handler has been registered
|
// Check if in the meantime another handler has been registered
|
||||||
if (!messageHandlers.isEmpty()) {
|
if (!messageHandlers.isEmpty()) {
|
||||||
|
logger.debug("Another handler has been registered, starting receive thread again");
|
||||||
startReceiveThreadIfRequired();
|
startReceiveThreadIfRequired();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1114,6 +1117,7 @@ public class ManagerImpl implements Manager {
|
||||||
}
|
}
|
||||||
handleQueuedActions(queuedActions);
|
handleQueuedActions(queuedActions);
|
||||||
queuedActions.clear();
|
queuedActions.clear();
|
||||||
|
dependencies.getSignalWebSocket().disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue