tor: remove logging
This commit is contained in:
parent
e379a7bf86
commit
cec83a5eb8
1 changed files with 5 additions and 11 deletions
|
@ -23,7 +23,7 @@ use futures::task::SpawnExt;
|
||||||
|
|
||||||
use grin_util::secp::SecretKey;
|
use grin_util::secp::SecretKey;
|
||||||
use arti_client::{TorClient, TorClientConfig};
|
use arti_client::{TorClient, TorClientConfig};
|
||||||
use arti_client::config::{BridgeConfigBuilder, TorClientConfigBuilder, CfgPath};
|
use arti_client::config::{TorClientConfigBuilder, CfgPath};
|
||||||
use fs_mistrust::Mistrust;
|
use fs_mistrust::Mistrust;
|
||||||
use ed25519_dalek::hazmat::ExpandedSecretKey;
|
use ed25519_dalek::hazmat::ExpandedSecretKey;
|
||||||
use curve25519_dalek::digest::Digest;
|
use curve25519_dalek::digest::Digest;
|
||||||
|
@ -79,16 +79,16 @@ impl Default for Tor {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let runtime = TokioNativeTlsRuntime::create().unwrap();
|
let runtime = TokioNativeTlsRuntime::create().unwrap();
|
||||||
let config = Self::build_config();
|
let config = Self::build_config();
|
||||||
let client = (TorClient::with_runtime(runtime)
|
let client = TorClient::with_runtime(runtime)
|
||||||
.config(config.clone())
|
.config(config.clone())
|
||||||
.create_unbootstrapped()
|
.create_unbootstrapped()
|
||||||
.unwrap(), config);
|
.unwrap();
|
||||||
Self {
|
Self {
|
||||||
running_services: Arc::new(RwLock::new(BTreeMap::new())),
|
running_services: Arc::new(RwLock::new(BTreeMap::new())),
|
||||||
starting_services: Arc::new(RwLock::new(BTreeSet::new())),
|
starting_services: Arc::new(RwLock::new(BTreeSet::new())),
|
||||||
failed_services: Arc::new(RwLock::new(BTreeSet::new())),
|
failed_services: Arc::new(RwLock::new(BTreeSet::new())),
|
||||||
checking_services: Arc::new(RwLock::new(BTreeSet::new())),
|
checking_services: Arc::new(RwLock::new(BTreeSet::new())),
|
||||||
client_config: Arc::new(RwLock::new((client))),
|
client_config: Arc::new(RwLock::new((client, config))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,6 @@ impl Tor {
|
||||||
|
|
||||||
// Restart Onion service.
|
// Restart Onion service.
|
||||||
pub fn restart_service(port: u16, key: SecretKey, id: &String) {
|
pub fn restart_service(port: u16, key: SecretKey, id: &String) {
|
||||||
println!("restart service");
|
|
||||||
Self::stop_service(id);
|
Self::stop_service(id);
|
||||||
Self::rebuild_client();
|
Self::rebuild_client();
|
||||||
Self::start_service(port, key, id)
|
Self::start_service(port, key, id)
|
||||||
|
@ -288,18 +287,15 @@ impl Tor {
|
||||||
.body(Body::from(data))
|
.body(Body::from(data))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// Send request.
|
// Send request.
|
||||||
println!("Send request");
|
|
||||||
let duration = match http.request(req).await {
|
let duration = match http.request(req).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("OK!");
|
|
||||||
// Remove service from starting.
|
// Remove service from starting.
|
||||||
let mut w_services = TOR_SERVER_STATE.starting_services.write();
|
let mut w_services = TOR_SERVER_STATE.starting_services.write();
|
||||||
w_services.remove(&service_id);
|
w_services.remove(&service_id);
|
||||||
// Check again after 15 seconds.
|
// Check again after 15 seconds.
|
||||||
Duration::from_millis(15000)
|
Duration::from_millis(15000)
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(_) => {
|
||||||
println!("err: {}", e);
|
|
||||||
// Restart service on 3rd error.
|
// Restart service on 3rd error.
|
||||||
errors_count += 1;
|
errors_count += 1;
|
||||||
if errors_count == MAX_ERRORS {
|
if errors_count == MAX_ERRORS {
|
||||||
|
@ -358,8 +354,6 @@ impl Tor {
|
||||||
let mut w_services = TOR_SERVER_STATE.running_services.write();
|
let mut w_services = TOR_SERVER_STATE.running_services.write();
|
||||||
w_services.insert(id.clone(), (service.clone(), proxy.clone()));
|
w_services.insert(id.clone(), (service.clone(), proxy.clone()));
|
||||||
|
|
||||||
println!("run_service_proxy done");
|
|
||||||
|
|
||||||
// Start proxy for launched service.
|
// Start proxy for launched service.
|
||||||
client
|
client
|
||||||
.runtime()
|
.runtime()
|
||||||
|
|
Loading…
Reference in a new issue