mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-11 05:10:53 +00:00
Fix SSK group leaving race condition
This commit is contained in:
parent
cd177ee61e
commit
a34b1f74b3
@ -130,12 +130,18 @@ object ClosedGroupsProtocol {
|
|||||||
Log.d("Loki", "Can't remove self and others simultaneously.")
|
Log.d("Loki", "Can't remove self and others simultaneously.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Send the update to the group (don't include new ratchets as everyone should regenerate new ratchets individually)
|
// Establish sessions if needed
|
||||||
|
establishSessionsWithMembersIfNeeded(context, members)
|
||||||
|
// Send the update to the existing members using established channels (don't include new ratchets as everyone should regenerate new ratchets individually)
|
||||||
|
for (member in oldMembers) {
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
val closedGroupUpdateKind = ClosedGroupUpdateMessageSendJob.Kind.Info(Hex.fromStringCondensed(groupPublicKey),
|
val closedGroupUpdateKind = ClosedGroupUpdateMessageSendJob.Kind.Info(Hex.fromStringCondensed(groupPublicKey),
|
||||||
name, setOf(), membersAsData, adminsAsData)
|
name, setOf(), membersAsData, adminsAsData)
|
||||||
val job = ClosedGroupUpdateMessageSendJob(groupPublicKey, closedGroupUpdateKind)
|
@Suppress("NAME_SHADOWING")
|
||||||
|
val job = ClosedGroupUpdateMessageSendJob(member, closedGroupUpdateKind)
|
||||||
job.setContext(context)
|
job.setContext(context)
|
||||||
job.onRun() // Run the job immediately
|
job.onRun() // Run the job immediately
|
||||||
|
}
|
||||||
// Delete all ratchets (it's important that this happens * after * sending out the update)
|
// Delete all ratchets (it's important that this happens * after * sending out the update)
|
||||||
sskDatabase.removeAllClosedGroupRatchets(groupPublicKey)
|
sskDatabase.removeAllClosedGroupRatchets(groupPublicKey)
|
||||||
// Remove the group from the user's set of public keys to poll for if the user is leaving. Otherwise generate a new ratchet and
|
// Remove the group from the user's set of public keys to poll for if the user is leaving. Otherwise generate a new ratchet and
|
||||||
@ -147,8 +153,6 @@ object ClosedGroupsProtocol {
|
|||||||
// Notify the PN server
|
// Notify the PN server
|
||||||
LokiPushNotificationManager.performOperation(context, ClosedGroupOperation.Unsubscribe, groupPublicKey, userPublicKey)
|
LokiPushNotificationManager.performOperation(context, ClosedGroupOperation.Unsubscribe, groupPublicKey, userPublicKey)
|
||||||
} else {
|
} else {
|
||||||
// Establish sessions if needed
|
|
||||||
establishSessionsWithMembersIfNeeded(context, members)
|
|
||||||
// Send closed group update messages to any new members using established channels
|
// Send closed group update messages to any new members using established channels
|
||||||
for (member in newMembers) {
|
for (member in newMembers) {
|
||||||
@Suppress("NAME_SHADOWING")
|
@Suppress("NAME_SHADOWING")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user