Skip to content

Commit

Permalink
Change the first seq from a fixed value to a random value
Browse files Browse the repository at this point in the history
  • Loading branch information
SajjadPourali committed Mar 15, 2024
1 parent ba40e3d commit 8a5b7cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ thiserror = { version = "1.0", default-features = false }
tracing = { version = "0.1", default-features = false, features = [
"log",
], optional = true }
rand = {version = "0.8.5", default-features = false, features = ["std","std_rng"] }

[dev-dependencies]
clap = { version = "4.5", features = ["derive"] }
Expand All @@ -35,6 +36,7 @@ tokio = { version = "1.36", features = [
"rt-multi-thread",
], default-features = false }


#tun2.rs example
tun2 = { version = "1.2", features = ["async"] }

Expand Down
3 changes: 3 additions & 0 deletions src/stream/tcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ pub(super) struct Tcb {

impl Tcb {
pub(super) fn new(ack: u32, tcp_timeout: Duration) -> Tcb {
#[cfg(debug_assertions)]
let seq = 100;
#[cfg(not(debug_assertions))]
let seq = rand::random::<u32>();
let deadline = tokio::time::Instant::now() + tcp_timeout;
Tcb {
seq,
Expand Down

0 comments on commit 8a5b7cf

Please sign in to comment.