mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
fix more clippy warnings
This commit is contained in:
parent
aabdf76a5d
commit
561cc3db55
16 changed files with 83 additions and 106 deletions
|
|
@ -172,7 +172,7 @@ fn process_response(
|
|||
pareto,
|
||||
info_hashes,
|
||||
r.connection_id
|
||||
).to_owned()
|
||||
)
|
||||
});
|
||||
|
||||
let new_transaction_id = generate_transaction_id(rng);
|
||||
|
|
@ -191,22 +191,22 @@ fn process_response(
|
|||
|
||||
},
|
||||
Response::Announce(r) => {
|
||||
return if_torrent_peer_move_and_create_random_request(
|
||||
if_torrent_peer_move_and_create_random_request(
|
||||
config,
|
||||
rng,
|
||||
info_hashes,
|
||||
torrent_peers,
|
||||
r.transaction_id
|
||||
);
|
||||
)
|
||||
},
|
||||
Response::Scrape(r) => {
|
||||
return if_torrent_peer_move_and_create_random_request(
|
||||
if_torrent_peer_move_and_create_random_request(
|
||||
config,
|
||||
rng,
|
||||
info_hashes,
|
||||
torrent_peers,
|
||||
r.transaction_id
|
||||
);
|
||||
)
|
||||
},
|
||||
Response::Error(r) => {
|
||||
if !r.message.to_lowercase().contains("connection"){
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
generate_transaction_id(&mut thread_rng())
|
||||
);
|
||||
|
||||
sender.send(request.into())
|
||||
sender.send(request)
|
||||
.expect("bootstrap: add initial request to request queue");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub fn create_socket(
|
|||
}
|
||||
|
||||
socket.bind(&addr.into())
|
||||
.expect(&format!("socket: bind to {}", addr));
|
||||
.unwrap_or_else(|err| panic!("socket: bind to {}: {:?}", addr, err));
|
||||
|
||||
socket.connect(&config.server_address.into())
|
||||
.expect("socket: connect to server");
|
||||
|
|
@ -80,28 +80,27 @@ pub fn run_socket_thread(
|
|||
.expect("failed polling");
|
||||
|
||||
for event in events.iter(){
|
||||
if event.token() == token {
|
||||
if event.is_readable(){
|
||||
read_responses(
|
||||
thread_id,
|
||||
&socket,
|
||||
&mut buffer,
|
||||
&mut local_state,
|
||||
&mut responses
|
||||
);
|
||||
if (event.token() == token) & event.is_readable(){
|
||||
read_responses(
|
||||
thread_id,
|
||||
&socket,
|
||||
&mut buffer,
|
||||
&mut local_state,
|
||||
&mut responses
|
||||
);
|
||||
|
||||
for r in responses.drain(..){
|
||||
response_channel_sender.send(r)
|
||||
.expect(&format!(
|
||||
"add response to channel in socket worker {}",
|
||||
thread_id.0
|
||||
));
|
||||
}
|
||||
|
||||
poll.registry()
|
||||
.reregister(&mut socket, token, interests)
|
||||
.unwrap();
|
||||
for r in responses.drain(..){
|
||||
response_channel_sender.send(r)
|
||||
.unwrap_or_else(|err| panic!(
|
||||
"add response to channel in socket worker {}: {:?}",
|
||||
thread_id.0,
|
||||
err
|
||||
));
|
||||
}
|
||||
|
||||
poll.registry()
|
||||
.reregister(&mut socket, token, interests)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
send_requests(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue