Don't reuse the same ConnectionChooser every time.

This is a fix for a backporting mistake.
This commit is contained in:
akwizgran
2018-03-07 16:47:08 +00:00
parent b0aa1517e5
commit 84e040605b

View File

@@ -10,6 +10,7 @@ import org.briarproject.bramble.api.plugin.PluginManager;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Provider;
@Immutable @Immutable
@NotNullByDefault @NotNullByDefault
@@ -19,22 +20,22 @@ class KeyAgreementTaskFactoryImpl implements KeyAgreementTaskFactory {
private final EventBus eventBus; private final EventBus eventBus;
private final PayloadEncoder payloadEncoder; private final PayloadEncoder payloadEncoder;
private final PluginManager pluginManager; private final PluginManager pluginManager;
private final ConnectionChooser connectionChooser; private final Provider<ConnectionChooser> connectionChooserProvider;
@Inject @Inject
KeyAgreementTaskFactoryImpl(CryptoComponent crypto, EventBus eventBus, KeyAgreementTaskFactoryImpl(CryptoComponent crypto, EventBus eventBus,
PayloadEncoder payloadEncoder, PluginManager pluginManager, PayloadEncoder payloadEncoder, PluginManager pluginManager,
ConnectionChooser connectionChooser) { Provider<ConnectionChooser> connectionChooserProvider) {
this.crypto = crypto; this.crypto = crypto;
this.eventBus = eventBus; this.eventBus = eventBus;
this.payloadEncoder = payloadEncoder; this.payloadEncoder = payloadEncoder;
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
this.connectionChooser = connectionChooser; this.connectionChooserProvider = connectionChooserProvider;
} }
@Override @Override
public KeyAgreementTask createTask() { public KeyAgreementTask createTask() {
return new KeyAgreementTaskImpl(crypto, eventBus, payloadEncoder, return new KeyAgreementTaskImpl(crypto, eventBus, payloadEncoder,
pluginManager, connectionChooser); pluginManager, connectionChooserProvider.get());
} }
} }