Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major refactoring #35

Merged
merged 40 commits into from
Nov 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8e50829
1/n [exponential backoff peers]: refactor "tx" to be once per connect…
ikatson Nov 17, 2023
55e692d
2/n Wrap PeerState into peer
ikatson Nov 17, 2023
6ebf212
Peers now reconnect!
ikatson Nov 17, 2023
2203ffe
Fixed bugs
ikatson Nov 18, 2023
db12bba
Not even sure what I'm doing
ikatson Nov 18, 2023
48a1482
Changed log to tracing
ikatson Nov 19, 2023
d39479a
Small refactorings
ikatson Nov 19, 2023
a745257
Split up a couple methods
ikatson Nov 19, 2023
38c9902
Change peer states to dashmap
ikatson Nov 19, 2023
adf3eef
Removed a couple deadlocks
ikatson Nov 19, 2023
19c3fd7
Uninline some methods for easier backtrace debugging
ikatson Nov 19, 2023
2b84202
Debugged one more deadlock (or it was the same one)
ikatson Nov 19, 2023
1a55936
Nothing
ikatson Nov 19, 2023
ff71ade
timed existence for lock time debugging
ikatson Nov 19, 2023
2ad2881
timed existence for lock time debugging
ikatson Nov 19, 2023
3f0c4b7
Fix the NotNeeded warning
ikatson Nov 19, 2023
124c605
more counters
ikatson Nov 19, 2023
17d4082
Timing on_received_message
ikatson Nov 19, 2023
4b3da0b
Trying to see why it hangs for a bit sometimes
ikatson Nov 19, 2023
0c6781b
Saving
ikatson Nov 19, 2023
b891cd4
Remove a couple unused methods
ikatson Nov 19, 2023
b40d33b
Fix a bug with wrong number of queued peers
ikatson Nov 19, 2023
98dbecf
Fix a logging bug
ikatson Nov 19, 2023
0170b19
Remove inline-nevers
ikatson Nov 19, 2023
adb98a2
Add more docs
ikatson Nov 19, 2023
2ebbc0a
Add examples
ikatson Nov 19, 2023
d6cef09
Remove an instance of double-locking in the same scope
ikatson Nov 19, 2023
0c89ee9
Add parameter with_peers to stats_snapshot while its slow
ikatson Nov 19, 2023
22ea146
Starting to implement aggregate peer stats
ikatson Nov 19, 2023
aa99872
WTF is going on with counters
ikatson Nov 20, 2023
88c2f9e
Finally fixed a stupid tracing bug with counters
ikatson Nov 20, 2023
1238593
Remove old slow peer stats computation
ikatson Nov 20, 2023
4a331d9
Make default peer connect timeout less = 2s
ikatson Nov 20, 2023
a9794de
New bug showing up when torrent is downloading super fast
ikatson Nov 20, 2023
1de690a
nothing
ikatson Nov 20, 2023
34ee9d9
Remove Option<BF> to just BF
ikatson Nov 20, 2023
2695a8e
Preventively fixed other race conditions
ikatson Nov 20, 2023
e2f909c
Add some documentation
ikatson Nov 20, 2023
b751b98
Update versions to 3.0.0 as theres a lot of changes internally
ikatson Nov 20, 2023
1b68b0e
Remove unnecessary debugging files
ikatson Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finally fixed a stupid tracing bug with counters
ikatson committed Nov 20, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 88c2f9e926344d34fe6fec4fb5ee22dbcd060821
13 changes: 2 additions & 11 deletions crates/librqbit/src/peer_state.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ use librqbit_core::lengths::{ChunkInfo, ValidPieceIndex};
use serde::Serialize;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use tokio::sync::{Notify, Semaphore};
use tracing::trace;

use crate::peer_connection::WriterRequest;
use crate::type_aliases::BF;
@@ -100,19 +99,11 @@ impl AggregatePeerStatsAtomic {
}

pub fn inc(&self, state: &PeerState) {
trace!(
"inc, new value = {}, state = {}",
atomic_inc(self.counter(state)),
state
);
atomic_inc(self.counter(state));
}

pub fn dec(&self, state: &PeerState) {
trace!(
"dec, new value = {}, state = {}",
atomic_dec(self.counter(state)),
state
);
atomic_dec(self.counter(state));
}

pub fn incdec(&self, old: &PeerState, new: &PeerState) {