Compile times are even worse now
This commit is contained in:
parent
18f22cf323
commit
15c078619c
11 changed files with 72 additions and 22 deletions
21
Cargo.lock
generated
21
Cargo.lock
generated
|
|
@ -1278,6 +1278,7 @@ dependencies = [
|
||||||
"librqbit-dht",
|
"librqbit-dht",
|
||||||
"librqbit-peer-protocol",
|
"librqbit-peer-protocol",
|
||||||
"librqbit-sha1-wrapper",
|
"librqbit-sha1-wrapper",
|
||||||
|
"librqbit-tracker-comms",
|
||||||
"librqbit-upnp",
|
"librqbit-upnp",
|
||||||
"openssl",
|
"openssl",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
|
@ -1397,6 +1398,26 @@ dependencies = [
|
||||||
"sha1",
|
"sha1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "librqbit-tracker-comms"
|
||||||
|
version = "1.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"async-stream",
|
||||||
|
"byteorder",
|
||||||
|
"futures",
|
||||||
|
"librqbit-bencode",
|
||||||
|
"librqbit-buffers",
|
||||||
|
"librqbit-core",
|
||||||
|
"rand",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"url",
|
||||||
|
"urlencoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "librqbit-upnp"
|
name = "librqbit-upnp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ members = [
|
||||||
"crates/peer_binary_protocol",
|
"crates/peer_binary_protocol",
|
||||||
"crates/dht",
|
"crates/dht",
|
||||||
"crates/upnp"
|
"crates/upnp"
|
||||||
]
|
, "crates/tracker_comms"]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ rust-tls = ["reqwest/rustls-tls"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bencode = {path = "../bencode", default-features=false, package="librqbit-bencode", version="2.2.1"}
|
bencode = {path = "../bencode", default-features=false, package="librqbit-bencode", version="2.2.1"}
|
||||||
|
tracker_comms = {path = "../tracker_comms", default-features=false, package="librqbit-tracker-comms", version="1.0.0"}
|
||||||
buffers = {path = "../buffers", package="librqbit-buffers", version = "2.2.1"}
|
buffers = {path = "../buffers", package="librqbit-buffers", version = "2.2.1"}
|
||||||
librqbit-core = {path = "../librqbit_core", version = "3.5.0"}
|
librqbit-core = {path = "../librqbit_core", version = "3.5.0"}
|
||||||
clone_to_owned = {path = "../clone_to_owned", package="librqbit-clone-to-owned", version = "2.2.1"}
|
clone_to_owned = {path = "../clone_to_owned", package="librqbit-clone-to-owned", version = "2.2.1"}
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,6 @@ mod session;
|
||||||
mod spawn_utils;
|
mod spawn_utils;
|
||||||
mod torrent_state;
|
mod torrent_state;
|
||||||
pub mod tracing_subscriber_config_utils;
|
pub mod tracing_subscriber_config_utils;
|
||||||
pub mod tracker_comms;
|
|
||||||
pub mod tracker_comms_http;
|
|
||||||
pub mod tracker_comms_udp;
|
|
||||||
mod type_aliases;
|
mod type_aliases;
|
||||||
|
|
||||||
pub use api::Api;
|
pub use api::Api;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,16 @@ use std::{
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
dht_utils::{read_metainfo_from_peer_receiver, ReadMetainfoResult},
|
||||||
|
peer_connection::PeerConnectionOptions,
|
||||||
|
read_buf::ReadBuf,
|
||||||
|
spawn_utils::BlockingSpawner,
|
||||||
|
torrent_state::{
|
||||||
|
ManagedTorrentBuilder, ManagedTorrentHandle, ManagedTorrentState, TorrentStateLive,
|
||||||
|
},
|
||||||
|
type_aliases::PeerStream,
|
||||||
|
};
|
||||||
use anyhow::{bail, Context};
|
use anyhow::{bail, Context};
|
||||||
use bencode::{bencode_serialize_to_writer, BencodeDeserializer};
|
use bencode::{bencode_serialize_to_writer, BencodeDeserializer};
|
||||||
use buffers::{ByteBuf, ByteBufT, ByteString};
|
use buffers::{ByteBuf, ByteBufT, ByteString};
|
||||||
|
|
@ -32,18 +42,7 @@ use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
use tokio_util::sync::{CancellationToken, DropGuard};
|
use tokio_util::sync::{CancellationToken, DropGuard};
|
||||||
use tracing::{debug, error, error_span, info, trace, warn, Instrument};
|
use tracing::{debug, error, error_span, info, trace, warn, Instrument};
|
||||||
|
use tracker_comms::TrackerComms;
|
||||||
use crate::{
|
|
||||||
dht_utils::{read_metainfo_from_peer_receiver, ReadMetainfoResult},
|
|
||||||
peer_connection::PeerConnectionOptions,
|
|
||||||
read_buf::ReadBuf,
|
|
||||||
spawn_utils::BlockingSpawner,
|
|
||||||
torrent_state::{
|
|
||||||
ManagedTorrentBuilder, ManagedTorrentHandle, ManagedTorrentState, TorrentStateLive,
|
|
||||||
},
|
|
||||||
tracker_comms::TrackerComms,
|
|
||||||
type_aliases::PeerStream,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const SUPPORTED_SCHEMES: [&str; 3] = ["http:", "https:", "magnet:"];
|
pub const SUPPORTED_SCHEMES: [&str; 3] = ["http:", "https:", "magnet:"];
|
||||||
|
|
||||||
|
|
|
||||||
27
crates/tracker_comms/Cargo.toml
Normal file
27
crates/tracker_comms/Cargo.toml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
[package]
|
||||||
|
name = "librqbit-tracker-comms"
|
||||||
|
version = "1.0.0"
|
||||||
|
edition = "2018"
|
||||||
|
description = "Common interface around various sha1 implementations used in rqbit torrent client."
|
||||||
|
license = "Apache-2.0"
|
||||||
|
documentation = "https://docs.rs/librqbit-tracker-comms"
|
||||||
|
repository = "https://github.com/ikatson/rqbit"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tokio = "1"
|
||||||
|
anyhow = "1"
|
||||||
|
futures = "0.3"
|
||||||
|
async-stream = "0.3.5"
|
||||||
|
buffers = {path = "../buffers", package="librqbit-buffers", version = "2.2.1"}
|
||||||
|
librqbit-core = {path = "../librqbit_core", version = "3.5.0"}
|
||||||
|
byteorder = "1.5"
|
||||||
|
serde = {version = "1", features=["derive"]}
|
||||||
|
urlencoding = "2"
|
||||||
|
rand = "0.8"
|
||||||
|
tracing = "0.1.40"
|
||||||
|
reqwest = {version="0.11.22", default-features=false, features = ["json"]}
|
||||||
|
bencode = {path = "../bencode", default-features=false, package="librqbit-bencode", version="2.2.1"}
|
||||||
|
url = "2"
|
||||||
Binary file not shown.
5
crates/tracker_comms/src/lib.rs
Normal file
5
crates/tracker_comms/src/lib.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
mod tracker_comms;
|
||||||
|
mod tracker_comms_http;
|
||||||
|
mod tracker_comms_udp;
|
||||||
|
|
||||||
|
pub use tracker_comms::*;
|
||||||
|
|
@ -12,9 +12,9 @@ const ACTION_ANNOUNCE: u32 = 1;
|
||||||
// const ACTION_ERROR: u32 = 3;
|
// const ACTION_ERROR: u32 = 3;
|
||||||
|
|
||||||
pub const EVENT_NONE: u32 = 0;
|
pub const EVENT_NONE: u32 = 0;
|
||||||
pub const EVENT_COMPLETED: u32 = 1;
|
// pub const EVENT_COMPLETED: u32 = 1;
|
||||||
pub const EVENT_STARTED: u32 = 2;
|
// pub const EVENT_STARTED: u32 = 2;
|
||||||
pub const EVENT_STOPPED: u32 = 3;
|
// pub const EVENT_STOPPED: u32 = 3;
|
||||||
|
|
||||||
pub type ConnectionId = u64;
|
pub type ConnectionId = u64;
|
||||||
const CONNECTION_ID_MAGIC: ConnectionId = 0x41727101980;
|
const CONNECTION_ID_MAGIC: ConnectionId = 0x41727101980;
|
||||||
|
|
@ -293,7 +293,7 @@ mod tests {
|
||||||
Response::Connect(connection_id) => {
|
Response::Connect(connection_id) => {
|
||||||
dbg!(connection_id)
|
dbg!(connection_id)
|
||||||
}
|
}
|
||||||
other => panic!("unexpected response {other:?}"),
|
other => panic!("unexpected response {:?}", other),
|
||||||
};
|
};
|
||||||
|
|
||||||
let hash = Id20::from_str("775459190aa65566591634203f8d9f17d341f969").unwrap();
|
let hash = Id20::from_str("775459190aa65566591634203f8d9f17d341f969").unwrap();
|
||||||
|
|
@ -335,7 +335,7 @@ mod tests {
|
||||||
Response::Announce(r) => {
|
Response::Announce(r) => {
|
||||||
dbg!(r);
|
dbg!(r);
|
||||||
}
|
}
|
||||||
other => panic!("unexpected response {other:?}"),
|
other => panic!("unexpected response {:?}", other),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue