mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Use Async.go() in OMEMO PEPListener
to avoid a deadlock, since the PEP listener is synchronous.
This commit is contained in:
parent
58181bab08
commit
c70a1921db
1 changed files with 16 additions and 9 deletions
|
@ -814,16 +814,23 @@ public final class OmemoManager extends Manager {
|
||||||
Set<Integer> deviceListIds = omemoDeviceListElement.copyDeviceIds();
|
Set<Integer> deviceListIds = omemoDeviceListElement.copyDeviceIds();
|
||||||
//enroll at the deviceList
|
//enroll at the deviceList
|
||||||
deviceListIds.add(ourDeviceId);
|
deviceListIds.add(ourDeviceId);
|
||||||
omemoDeviceListElement = new OmemoDeviceListVAxolotlElement(deviceListIds);
|
final OmemoDeviceListVAxolotlElement newOmemoDeviceListElement = new OmemoDeviceListVAxolotlElement(deviceListIds);
|
||||||
|
|
||||||
try {
|
// PEPListener is a synchronous listener. Avoid any deadlocks by using an async task to update the device list.
|
||||||
OmemoService.publishDeviceIds(OmemoManager.this, omemoDeviceListElement);
|
Async.go(new Runnable() {
|
||||||
} catch (SmackException | InterruptedException | XMPPException.XMPPErrorException e) {
|
@Override
|
||||||
//TODO: It might be dangerous NOT to retry publishing our deviceId
|
public void run() {
|
||||||
LOGGER.log(Level.SEVERE,
|
try {
|
||||||
"Could not publish our device list after an update without our id was received: "
|
OmemoService.publishDeviceIds(OmemoManager.this, newOmemoDeviceListElement);
|
||||||
+ e.getMessage());
|
}
|
||||||
}
|
catch (SmackException | InterruptedException | XMPPException.XMPPErrorException e) {
|
||||||
|
// TODO: It might be dangerous NOT to retry publishing our deviceId
|
||||||
|
LOGGER.log(Level.SEVERE,
|
||||||
|
"Could not publish our device list after an update without our id was received: "
|
||||||
|
+ e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue