Skip to content

Commit

Permalink
Use the same peerlink config for Tor and non-Tor cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred-hodler committed May 23, 2024
1 parent f350bc9 commit c9216f1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions pushtx/src/p2p/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ use crate::net;
use super::protocol;

pub fn client(socks_proxy: Option<SocketAddr>, network: crate::Network) -> Client {
let config = peerlink::Config {
stream_config: peerlink::StreamConfig {
tx_buf_min_size: 4096,
..Default::default()
},
receive_buffer_size: 32 * 1024,
..Default::default()
};

let (handle, join_handle) = match socks_proxy {
Some(proxy) => {
let (reactor, handle) = peerlink::Reactor::with_connector(
peerlink::Config {
stream_config: peerlink::StreamConfig {
tx_buf_min_size: 4096,
..Default::default()
},
receive_buffer_size: 32 * 1024,
..Default::default()
},
config,
peerlink::connector::Socks5Connector {
proxy,
// random proxy credentials to get an isolated Tor circuit
Expand All @@ -37,7 +39,7 @@ pub fn client(socks_proxy: Option<SocketAddr>, network: crate::Network) -> Clien
(handle, reactor.run())
}
None => {
let (reactor, handle) = peerlink::Reactor::new(Default::default()).unwrap();
let (reactor, handle) = peerlink::Reactor::new(config).unwrap();
(handle, reactor.run())
}
};
Expand Down

0 comments on commit c9216f1

Please sign in to comment.