Nothing
This commit is contained in:
parent
1b5e565aff
commit
7e4ed79863
3 changed files with 7 additions and 13 deletions
|
|
@ -19,11 +19,9 @@ use log::{debug, info, trace, warn};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use tokio::{
|
use tokio::{
|
||||||
net::UdpSocket,
|
net::UdpSocket,
|
||||||
sync::mpsc::{
|
sync::mpsc::{channel, unbounded_channel, Sender, UnboundedReceiver, UnboundedSender},
|
||||||
channel, unbounded_channel, Receiver, Sender, UnboundedReceiver, UnboundedSender,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use tokio_stream::wrappers::{BroadcastStream, UnboundedReceiverStream};
|
use tokio_stream::wrappers::BroadcastStream;
|
||||||
|
|
||||||
struct OutstandingRequest {
|
struct OutstandingRequest {
|
||||||
transaction_id: u16,
|
transaction_id: u16,
|
||||||
|
|
@ -220,7 +218,7 @@ impl DhtState {
|
||||||
.map(|c| c.iter().copied().collect())
|
.map(|c| c.iter().copied().collect())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let rx = o.get().subscribe();
|
let rx = o.get().subscribe();
|
||||||
return Ok((existing_peers, rx));
|
Ok((existing_peers, rx))
|
||||||
}
|
}
|
||||||
Entry::Vacant(v) => {
|
Entry::Vacant(v) => {
|
||||||
let (tx, rx) = tokio::sync::broadcast::channel(100);
|
let (tx, rx) = tokio::sync::broadcast::channel(100);
|
||||||
|
|
@ -243,7 +241,7 @@ impl DhtState {
|
||||||
.context("DhtState: error sending to self.sender")?;
|
.context("DhtState: error sending to self.sender")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok((Vec::new(), rx));
|
Ok((Vec::new(), rx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -385,7 +383,7 @@ async fn run_framer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err::<(), _>(anyhow::anyhow!(
|
Err::<(), _>(anyhow::anyhow!(
|
||||||
"DHT UDP socket reader over, nowhere to read messages from"
|
"DHT UDP socket reader over, nowhere to send responses to"
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
let result = tokio::select! {
|
let result = tokio::select! {
|
||||||
|
|
@ -401,11 +399,6 @@ enum Request {
|
||||||
FindNode(Id20),
|
FindNode(Id20),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
enum Response {
|
|
||||||
Peer(SocketAddr),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Dht {
|
pub struct Dht {
|
||||||
state: Arc<Mutex<DhtState>>,
|
state: Arc<Mutex<DhtState>>,
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,7 @@ impl TorrentManager {
|
||||||
lengths,
|
lengths,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[allow(clippy::needless_update)]
|
||||||
let state_options = TorrentStateOptions {
|
let state_options = TorrentStateOptions {
|
||||||
peer_connect_timeout: options.peer_connect_timeout,
|
peer_connect_timeout: options.peer_connect_timeout,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{fs::File, io::Read, net::SocketAddr, pin::Pin, str::FromStr, time::Duration};
|
use std::{fs::File, io::Read, net::SocketAddr, str::FromStr, time::Duration};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::Clap;
|
use clap::Clap;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue