Skip to content

Commit

Permalink
tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed Aug 10, 2024
1 parent 7be6e23 commit 4c51bec
Show file tree
Hide file tree
Showing 24 changed files with 540 additions and 221 deletions.
2 changes: 1 addition & 1 deletion packages/util/src/trans/locally_shuffled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TRANSACTION_ID_PREALLOC_LEN: usize = 2048;
/// transaction type (such as u64) but also works with smaller types.
#[allow(clippy::module_name_repetitions)]
#[derive(Default)]
#[derive(Debug, Default)]
pub struct LocallyShuffledIds<T> {
sequential: SequentialIds<T>,
stored_ids: Vec<T>,
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/trans/sequential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::trans::TransactionIds;

/// Generates sequentially unique ids and wraps when overflow occurs.
#[allow(clippy::module_name_repetitions)]
#[derive(Default)]
#[derive(Debug, Default)]
pub struct SequentialIds<T> {
next_id: T,
}
Expand Down
1 change: 1 addition & 0 deletions packages/utracker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ nom = "7"
rand = "0"
umio = "0"
tracing = "0"
thiserror = "1"

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
Expand Down
5 changes: 5 additions & 0 deletions packages/utracker/src/announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use nom::multi::count;
use nom::number::complete::{be_i32, be_i64, be_u16, be_u32, be_u8};
use nom::sequence::tuple;
use nom::IResult;
use tracing::instrument;
use util::bt::{self, InfoHash, PeerId};
use util::convert;

Expand Down Expand Up @@ -47,6 +48,7 @@ pub struct AnnounceRequest<'a> {
#[allow(clippy::too_many_arguments)]
impl<'a> AnnounceRequest<'a> {
/// Create a new `AnnounceRequest`.
#[instrument(skip())]
#[must_use]
pub fn new(
hash: InfoHash,
Expand All @@ -58,6 +60,7 @@ impl<'a> AnnounceRequest<'a> {
port: u16,
options: AnnounceOptions<'a>,
) -> AnnounceRequest<'a> {
tracing::trace!("new announce request");
AnnounceRequest {
info_hash: hash,
peer_id,
Expand Down Expand Up @@ -324,7 +327,9 @@ pub struct ClientState {
impl ClientState {
/// Create a new `ClientState`.
#[must_use]
#[instrument(skip())]
pub fn new(bytes_downloaded: i64, bytes_left: i64, bytes_uploaded: i64, event: AnnounceEvent) -> ClientState {
tracing::trace!("new client state");
ClientState {
downloaded: bytes_downloaded,
left: bytes_left,
Expand Down
Loading

0 comments on commit 4c51bec

Please sign in to comment.