Skip to content

Commit eafafce

Browse files
In workspace:
- Pulled `project-pin-lite` into workspace dependencies. This will later replace `project-pin`. In `cuprate-p2p-core`: - Propagated the `send_timeout` field to TcpInBoundStream In `cuprate-helper`: - Implemented `WriteTimeout` and `ReadTimeout` wrapper of `AsyncWrite` and `AsyncRead` respectively. - Implemented `StreamTimeout` wrapper for `AsyncWrite + AsyncRead` types. - Defined `ExtractDuration` trait for more flexibility on computing the timeout duration. - Added 6 TCP tests (read/write/ok/err and stream/err)
1 parent a23ca6f commit eafafce

File tree

7 files changed

+546
-9
lines changed

7 files changed

+546
-9
lines changed

Cargo.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ monero-serai = { git = "https://github.com/Cuprate/serai.git", rev = "e
132132
nu-ansi-term = { version = "0.46", default-features = false }
133133
paste = { version = "1", default-features = false }
134134
pin-project = { version = "1", default-features = false }
135+
pin-project-lite = { version = "0.2.16", default-features = false }
135136
randomx-rs = { git = "https://github.com/Cuprate/randomx-rs.git", rev = "e09955c", default-features = false }
136137
rand = { version = "0.8", default-features = false }
137138
rand_distr = { version = "0.4", default-features = false }

helper/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ time = ["dep:chrono", "std"]
2424
thread = ["std", "dep:target_os_lib"]
2525
tx = ["dep:monero-serai"]
2626
fmt = ["map", "std"]
27+
timeout = ["std", "dep:pin-project-lite", "dep:tokio"]
2728

2829
[dependencies]
2930
cuprate-constants = { workspace = true, optional = true, features = ["block"] }
@@ -35,6 +36,8 @@ dirs = { workspace = true, optional = true }
3536
futures = { workspace = true, optional = true, features = ["std"] }
3637
monero-serai = { workspace = true, optional = true }
3738
rayon = { workspace = true, optional = true }
39+
tokio = { workspace = true, optional = true, features = ["time"] }
40+
pin-project-lite = { workspace = true, optional = true }
3841

3942
serde = { workspace = true, optional = true, features = ["derive"] }
4043

helper/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub mod cast;
1414
#[cfg(feature = "fs")]
1515
pub mod fs;
1616

17+
#[cfg(feature = "timeout")]
18+
pub mod timeout;
19+
1720
pub mod network;
1821

1922
#[cfg(feature = "num")]

0 commit comments

Comments
 (0)