Dude this is like production ready!
This commit is contained in:
parent
34dd074310
commit
df282ae9d8
4 changed files with 15 additions and 26 deletions
8
Makefile
8
Makefile
|
|
@ -4,4 +4,10 @@ sign-debug:
|
||||||
codesign -f --entitlements resources/debugging.entitlements -s - target/debug/rqbit
|
codesign -f --entitlements resources/debugging.entitlements -s - target/debug/rqbit
|
||||||
|
|
||||||
sign-release:
|
sign-release:
|
||||||
codesign -f --entitlements resources/debugging.entitlements -s - target/release/rqbit
|
codesign -f --entitlements resources/debugging.entitlements -s - target/release/rqbit
|
||||||
|
|
||||||
|
build-release:
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
install: build-release
|
||||||
|
cp target/release/rqbit "$(HOME)/bin/"
|
||||||
26
TODO.md
26
TODO.md
|
|
@ -5,30 +5,12 @@
|
||||||
- [x] use the "update_hash" function in piece checking
|
- [x] use the "update_hash" function in piece checking
|
||||||
- [ ] signaling when file is done
|
- [ ] signaling when file is done
|
||||||
|
|
||||||
|
- [ ]
|
||||||
|
|
||||||
- [ ] per-file stats
|
- [ ] per-file stats
|
||||||
- [ ] per-peer stats
|
- [ ] per-peer stats
|
||||||
|
|
||||||
- [ ] slow peers cause slowness in the end, need the "end of game" algorithm
|
- [x] slow peers cause slowness in the end, need the "end of game" algorithm
|
||||||
- [ ] will require implementing cancel message
|
|
||||||
|
|
||||||
someday:
|
someday:
|
||||||
- [ ] cancellation from the client-side for the lib (i.e. stop the torrent manager)
|
- [ ] cancellation from the client-side for the lib (i.e. stop the torrent manager)
|
||||||
|
|
||||||
|
|
||||||
# concurrency
|
|
||||||
it's fucked up now, so need to rethink.
|
|
||||||
|
|
||||||
Sequencing:
|
|
||||||
- when the peer sends bitfield
|
|
||||||
- update its bitfield
|
|
||||||
- this can only happen at the start. But it can also NOT happen at all (if the peer wants to download)
|
|
||||||
- so we actually cannot use it as a trigger to start the "uploader" of it (where we upload to it)
|
|
||||||
- however both this and "have" we can use as a trigger to start the "downloader" part of it
|
|
||||||
- when the peer sends "interested"
|
|
||||||
- when the peer sends "have"
|
|
||||||
- update its bitfield
|
|
||||||
|
|
||||||
"peer downloader":
|
|
||||||
- if started, means there was some initial interest
|
|
||||||
- if we are unchoked:
|
|
||||||
- fetch new pieces forever from the queue, send requests
|
|
||||||
|
|
@ -123,7 +123,7 @@ impl PeerConnection {
|
||||||
WriterRequest::Message(msg) => msg.serialize(&mut buf),
|
WriterRequest::Message(msg) => msg.serialize(&mut buf),
|
||||||
WriterRequest::ReadChunkRequest(chunk) => {
|
WriterRequest::ReadChunkRequest(chunk) => {
|
||||||
// this whole section is an optimization
|
// this whole section is an optimization
|
||||||
|
buf.resize(PIECE_MESSAGE_DEFAULT_LEN, 0);
|
||||||
let preamble_len = serialize_piece_preamble(&chunk, &mut buf);
|
let preamble_len = serialize_piece_preamble(&chunk, &mut buf);
|
||||||
let full_len = preamble_len + chunk.size as usize;
|
let full_len = preamble_len + chunk.size as usize;
|
||||||
buf.resize(full_len, 0);
|
buf.resize(full_len, 0);
|
||||||
|
|
@ -280,7 +280,7 @@ impl PeerConnection {
|
||||||
// Theoretically, this could be done in the sending code, so that it reads straight into
|
// Theoretically, this could be done in the sending code, so that it reads straight into
|
||||||
// the send buffer.
|
// the send buffer.
|
||||||
let request = WriterRequest::ReadChunkRequest(chunk_info);
|
let request = WriterRequest::ReadChunkRequest(chunk_info);
|
||||||
info!("sending to {}: {:?}", peer_handle, &request);
|
debug!("sending to {}: {:?}", peer_handle, &request);
|
||||||
Ok::<_, anyhow::Error>(tx.send(request).await?)
|
Ok::<_, anyhow::Error>(tx.send(request).await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,7 @@ impl TorrentManager {
|
||||||
match this.tracker_one_request(tracker_url.clone()).await {
|
match this.tracker_one_request(tracker_url.clone()).await {
|
||||||
Ok(interval) => {
|
Ok(interval) => {
|
||||||
event = None;
|
event = None;
|
||||||
|
let interval = 30;
|
||||||
let duration = Duration::from_secs(interval);
|
let duration = Duration::from_secs(interval);
|
||||||
debug!(
|
debug!(
|
||||||
"sleeping for {:?} after calling tracker {}",
|
"sleeping for {:?} after calling tracker {}",
|
||||||
|
|
@ -295,7 +296,7 @@ impl TorrentManager {
|
||||||
tokio::time::sleep(duration).await;
|
tokio::time::sleep(duration).await;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("error calling the tracker {}: {:#}", tracker_url, e);
|
debug!("error calling the tracker {}: {:#}", tracker_url, e);
|
||||||
tokio::time::sleep(Duration::from_secs(60)).await;
|
tokio::time::sleep(Duration::from_secs(60)).await;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue