mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_http, aquatic_common_tcp: fix some clippy warnings
This commit is contained in:
parent
8269ae2994
commit
b65297195a
5 changed files with 8 additions and 11 deletions
|
|
@ -22,7 +22,7 @@ pub fn create_tls_acceptor(
|
|||
.context("Couldn't read pkcs12 identity file")?;
|
||||
|
||||
let identity = Identity::from_pkcs12(
|
||||
&mut identity_bytes,
|
||||
&identity_bytes[..],
|
||||
&config.tls_pkcs12_password
|
||||
).context("Couldn't parse pkcs12 identity file")?;
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pub fn handle_announce_requests(
|
|||
){
|
||||
let valid_until = ValidUntil::new(config.cleaning.max_peer_age);
|
||||
|
||||
responses.extend(requests.into_iter().map(|(request_sender_meta, request)| {
|
||||
responses.extend(requests.map(|(request_sender_meta, request)| {
|
||||
let torrent_data: &mut TorrentData = if request_sender_meta.peer_addr.is_ipv4(){
|
||||
torrent_maps.ipv4.entry(request.info_hash).or_default()
|
||||
} else {
|
||||
|
|
@ -117,7 +117,7 @@ pub fn handle_announce_requests(
|
|||
};
|
||||
|
||||
let ip_or_key = request.key
|
||||
.map(|k| Either::Right(k))
|
||||
.map(Either::Right)
|
||||
.unwrap_or_else(||
|
||||
Either::Left(request_sender_meta.peer_addr.ip())
|
||||
);
|
||||
|
|
|
|||
|
|
@ -68,11 +68,8 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
|||
|
||||
if let Some(statuses) = socket_worker_statuses.try_lock(){
|
||||
for opt_status in statuses.iter(){
|
||||
match opt_status {
|
||||
Some(Err(err)) => {
|
||||
if let Some(Err(err)) = opt_status {
|
||||
return Err(::anyhow::anyhow!(err.to_owned()));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ pub enum Response {
|
|||
|
||||
|
||||
impl Response {
|
||||
pub fn to_bytes(self) -> Vec<u8> {
|
||||
match bendy::serde::to_bytes(&self){
|
||||
pub fn to_bytes(&self) -> Vec<u8> {
|
||||
match bendy::serde::to_bytes(self){
|
||||
Ok(bytes) => bytes,
|
||||
Err(err) => {
|
||||
log::error!("error encoding response: {}", err);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ pub fn serialize_20_bytes<S>(
|
|||
|
||||
|
||||
pub fn serialize_response_peers_compact<S>(
|
||||
response_peers: &Vec<ResponsePeer>,
|
||||
response_peers: &[ResponsePeer],
|
||||
serializer: S
|
||||
) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
let mut bytes = Vec::with_capacity(response_peers.len() * 6);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue