Improve logging for provisioning

This commit is contained in:
AsamK 2021-01-16 08:59:15 +01:00
parent c0f5ff8805
commit a97bbf8608
2 changed files with 19 additions and 6 deletions

View file

@ -20,6 +20,8 @@ import org.asamk.signal.manager.storage.SignalAccount;
import org.asamk.signal.manager.util.KeyUtils; import org.asamk.signal.manager.util.KeyUtils;
import org.signal.zkgroup.InvalidInputException; import org.signal.zkgroup.InvalidInputException;
import org.signal.zkgroup.profiles.ProfileKey; import org.signal.zkgroup.profiles.ProfileKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.util.KeyHelper; import org.whispersystems.libsignal.util.KeyHelper;
@ -38,6 +40,8 @@ import java.util.concurrent.TimeoutException;
public class ProvisioningManager { public class ProvisioningManager {
private final static Logger logger = LoggerFactory.getLogger(Manager.class);
private final PathConfig pathConfig; private final PathConfig pathConfig;
private final SignalServiceConfiguration serviceConfiguration; private final SignalServiceConfiguration serviceConfiguration;
private final String userAgent; private final String userAgent;
@ -117,12 +121,22 @@ public class ProvisioningManager {
try (Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent)) { try (Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent)) {
m.refreshPreKeys(); try {
m.refreshPreKeys();
} catch (Exception e) {
logger.error("Failed to refresh prekeys.");
throw e;
}
m.requestSyncGroups(); try {
m.requestSyncContacts(); m.requestSyncGroups();
m.requestSyncBlocked(); m.requestSyncContacts();
m.requestSyncConfiguration(); m.requestSyncBlocked();
m.requestSyncConfiguration();
} catch (Exception e) {
logger.error("Failed to request sync messages from linked device.");
throw e;
}
m.close(false); m.close(false);
} }

View file

@ -112,7 +112,6 @@ public class RegistrationManager implements AutoCloseable {
accountManager.requestSmsVerificationCode(false, Optional.fromNullable(captcha), Optional.absent()); accountManager.requestSmsVerificationCode(false, Optional.fromNullable(captcha), Optional.absent());
} }
account.setRegistered(false);
account.save(); account.save();
} }