mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add missing isActive check
This commit is contained in:
parent
b903102407
commit
43bcc95713
1 changed files with 8 additions and 5 deletions
|
@ -109,11 +109,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
|
||||
synchronized (cachedSessions) {
|
||||
final var session = loadSessionLocked(key);
|
||||
if (session == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return session.hasSenderChain() && session.getSessionVersion() == CiphertextMessage.CURRENT_VERSION;
|
||||
return isActive(session);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +154,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
return recipientIdToNameMap.keySet()
|
||||
.stream()
|
||||
.flatMap(recipientId -> getKeysLocked(recipientId).stream())
|
||||
.filter(key -> isActive(this.loadSessionLocked(key)))
|
||||
.map(key -> new SignalProtocolAddress(recipientIdToNameMap.get(key.recipientId), key.getDeviceId()))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
@ -321,6 +318,12 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isActive(SessionRecord record) {
|
||||
return record != null
|
||||
&& record.hasSenderChain()
|
||||
&& record.getSessionVersion() == CiphertextMessage.CURRENT_VERSION;
|
||||
}
|
||||
|
||||
private static final class Key {
|
||||
|
||||
private final RecipientId recipientId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue