tor: fix restart

This commit is contained in:
ardocrat 2024-04-25 15:41:28 +03:00
parent 5cf283696e
commit 1e6376c497

View file

@ -104,10 +104,9 @@ impl TorServer {
// Check if Tor client is already running. // Check if Tor client is already running.
if TOR_SERVER_STATE.client.read().unwrap().is_some() { if TOR_SERVER_STATE.client.read().unwrap().is_some() {
let r_client = TOR_SERVER_STATE.client.read().unwrap(); let r_client = TOR_SERVER_STATE.client.read().unwrap();
let runtime = TokioNativeTlsRuntime::create().unwrap(); let client = r_client.as_ref().unwrap().clone();
let _ = runtime.clone().block_on( let runtime = client.runtime().clone();
Self::launch_socks_proxy(runtime, r_client.as_ref().unwrap().clone()) let _ = runtime.clone().block_on(Self::launch_socks_proxy(runtime, client));
);
} else { } else {
// Create Tor client config to connect. // Create Tor client config to connect.
let mut builder = TorClientConfig::builder(); let mut builder = TorClientConfig::builder();