1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Remove LOCK in OmemoManager and use Manager instance instead

This commit is contained in:
Florian Schmaus 2019-08-06 08:23:10 +02:00
parent d7b7abc7eb
commit 9923268391
4 changed files with 103 additions and 132 deletions

View file

@ -55,6 +55,7 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
* Bob still has B2
* @throws Exception
*/
@SuppressWarnings("SynchronizeOnNonFinalField")
@SmackIntegrationTest
public void messageTest() throws Exception {
OmemoBundleElement a1 = alice.getOmemoService().getOmemoStoreBackend().packOmemoBundle(alice.getOwnDevice());
@ -74,7 +75,7 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
OmemoBundleElement a1_ = alice.getOmemoService().getOmemoStoreBackend().packOmemoBundle(alice.getOwnDevice());
OmemoBundleElement b2;
synchronized (bob.LOCK) { // Circumvent race condition where bundle gets replenished after getting stored in b2
synchronized (bob) { // Circumvent race condition where bundle gets replenished after getting stored in b2
b2 = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice());
}

View file

@ -31,6 +31,7 @@ public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIn
super(environment);
}
@SuppressWarnings("SynchronizeOnNonFinalField")
@SmackIntegrationTest
public void sessionRenegotiationTest() throws Exception {
@ -50,7 +51,7 @@ public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIn
bob.removeOmemoMessageListener(listener1);
// Remove the session on Bobs side.
synchronized (bob.LOCK) {
synchronized (bob) {
bob.getOmemoService().getOmemoStoreBackend().removeRawSession(bob.getOwnDevice(), alice.getOwnDevice());
}