From f37125efbe6262ef2ffb0369fca476aaab576c93 Mon Sep 17 00:00:00 2001 From: fosse <matt.cfosse@gmail.com> Date: Mon, 29 Jan 2024 14:19:27 -0500 Subject: [PATCH] hopefully fix performance issues --- lib/view_model/settings/tor_view_model.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/view_model/settings/tor_view_model.dart b/lib/view_model/settings/tor_view_model.dart index b9cf79892..dfd182c9e 100644 --- a/lib/view_model/settings/tor_view_model.dart +++ b/lib/view_model/settings/tor_view_model.dart @@ -29,7 +29,7 @@ abstract class TorViewModelBase with Store { bool torStarted = false; final SettingsStore _settingsStore; - final Tor tor = Tor.instance; + Tor tor = Tor.instance; @action Future<void> updateStartOnLaunch(bool value) async { @@ -72,7 +72,7 @@ abstract class TorViewModelBase with Store { if (!torStarted) { torStarted = true; - await Tor.init(); + tor = await Tor.init(); await Tor.instance.enable(); } @@ -81,7 +81,7 @@ abstract class TorViewModelBase with Store { SocksTCPClient.setProxy(proxies: [ ProxySettings( InternetAddress.loopbackIPv4, - Tor.instance.port, + tor.port, password: null, ), ]); @@ -101,7 +101,7 @@ abstract class TorViewModelBase with Store { // setting the torConnectionMode to disabled will prevent anything from actually using the proxy _settingsStore.shouldStartTorOnLaunch = false; torConnectionStatus = TorConnectionStatus.disconnected; - await connectOrDisconnectNodeToProxy(connect: false); SocksTCPClient.removeProxy(); + await connectOrDisconnectNodeToProxy(connect: false); } }