mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic: add and use num_threads setting
This commit is contained in:
parent
19277831c8
commit
f5700bfa18
2 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ use std::net::SocketAddr;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
pub num_threads: usize,
|
||||||
pub recv_buffer_size: usize,
|
pub recv_buffer_size: usize,
|
||||||
pub max_scrape_torrents: u8,
|
pub max_scrape_torrents: u8,
|
||||||
pub max_response_peers: usize,
|
pub max_response_peers: usize,
|
||||||
|
|
@ -15,6 +16,7 @@ impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
address: SocketAddr::from(([127, 0, 0, 1], 3000)),
|
address: SocketAddr::from(([127, 0, 0, 1], 3000)),
|
||||||
|
num_threads: 4,
|
||||||
recv_buffer_size: 4096 * 16,
|
recv_buffer_size: 4096 * 16,
|
||||||
max_scrape_torrents: 255,
|
max_scrape_torrents: 255,
|
||||||
max_response_peers: 255,
|
max_response_peers: 255,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ pub fn run(){
|
||||||
let state = State::new();
|
let state = State::new();
|
||||||
let socket = network::create_socket(&config);
|
let socket = network::create_socket(&config);
|
||||||
|
|
||||||
for i in 0..4 {
|
for i in 0..config.num_threads {
|
||||||
let socket = socket.try_clone().unwrap();
|
let socket = socket.try_clone().unwrap();
|
||||||
let state = state.clone();
|
let state = state.clone();
|
||||||
let config = config.clone();
|
let config = config.clone();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue