Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SajjadPourali committed Apr 16, 2024
1 parent 2cadc16 commit f688dc6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/stream/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ impl IpStackTcpStream {
shutdown: Shutdown::default(),
write_notify: None,
};
if !tcp.inner().syn {
if !tcp.inner().rst {
_ = pkt_sender.send(stream.create_rev_packet(RST | ACK, TTL, None, Vec::new())?);
}
Err(IpStackError::InvalidTcpPacket)
} else {
Ok(stream)
if tcp.inner().syn {
return Ok(stream);
}
if !tcp.inner().rst {
_ = pkt_sender.send(stream.create_rev_packet(RST | ACK, TTL, None, Vec::new())?);
}
Err(IpStackError::InvalidTcpPacket)
}

fn calculate_payload_len(&self, ip_header_size: u16, tcp_header_size: u16) -> u16 {
Expand Down

0 comments on commit f688dc6

Please sign in to comment.