mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +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) {
|
synchronized (cachedSessions) {
|
||||||
final var session = loadSessionLocked(key);
|
final var session = loadSessionLocked(key);
|
||||||
if (session == null) {
|
return isActive(session);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return session.hasSenderChain() && session.getSessionVersion() == CiphertextMessage.CURRENT_VERSION;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +154,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
||||||
return recipientIdToNameMap.keySet()
|
return recipientIdToNameMap.keySet()
|
||||||
.stream()
|
.stream()
|
||||||
.flatMap(recipientId -> getKeysLocked(recipientId).stream())
|
.flatMap(recipientId -> getKeysLocked(recipientId).stream())
|
||||||
|
.filter(key -> isActive(this.loadSessionLocked(key)))
|
||||||
.map(key -> new SignalProtocolAddress(recipientIdToNameMap.get(key.recipientId), key.getDeviceId()))
|
.map(key -> new SignalProtocolAddress(recipientIdToNameMap.get(key.recipientId), key.getDeviceId()))
|
||||||
.collect(Collectors.toSet());
|
.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 static final class Key {
|
||||||
|
|
||||||
private final RecipientId recipientId;
|
private final RecipientId recipientId;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue