mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-01 14:13:22 +01:00
Make sure not more than one libsignal Network instance is ever created
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
544cc06f13
commit
78e36b85d4
@@ -365,12 +365,12 @@ public class SignalServiceAccountManager {
|
||||
Optional<byte[]> token,
|
||||
String mrEnclave,
|
||||
Long timeoutMs,
|
||||
@Nullable Network.Environment libsignalNetEnv,
|
||||
@Nullable Network libsignalNetwork,
|
||||
Consumer<byte[]> tokenSaver)
|
||||
throws IOException
|
||||
{
|
||||
CdsiAuthResponse auth = pushServiceSocket.getCdsiAuth();
|
||||
CdsiV2Service service = new CdsiV2Service(configuration, mrEnclave, libsignalNetEnv);
|
||||
CdsiV2Service service = new CdsiV2Service(configuration, mrEnclave, libsignalNetwork);
|
||||
CdsiV2Service.Request request = new CdsiV2Service.Request(previousE164s, newE164s, serviceIds, token);
|
||||
Single<ServiceResponse<CdsiV2Service.Response>> single = service.getRegisteredUsers(auth.getUsername(), auth.getPassword(), request, tokenSaver);
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ import java.util.concurrent.Future;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.Single;
|
||||
import okio.ByteString;
|
||||
@@ -51,10 +53,9 @@ public final class CdsiV2Service {
|
||||
|
||||
private final CdsiRequestHandler cdsiRequestHandler;
|
||||
|
||||
public CdsiV2Service(SignalServiceConfiguration configuration, String mrEnclave, Network.Environment libsignalEnv) {
|
||||
public CdsiV2Service(SignalServiceConfiguration configuration, String mrEnclave, @Nullable Network network) {
|
||||
|
||||
if (libsignalEnv != null) {
|
||||
Network network = new Network(libsignalEnv);
|
||||
if (network != null) {
|
||||
this.cdsiRequestHandler = (username, password, request, tokenSaver) -> {
|
||||
try {
|
||||
Log.i(TAG, "Starting CDSI lookup via libsignal-net");
|
||||
|
||||
Reference in New Issue
Block a user