Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
SajjadPourali committed Jul 3, 2024
1 parent d3fbc5c commit 755f807
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/stream/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,12 @@ impl IpStackTcpStream {
);

tcp_header.acknowledgment_number = self.tcb.get_ack();
if flags & SYN != 0 {
tcp_header.syn = true;
}
if flags & ACK != 0 {
tcp_header.ack = true;
}
if flags & RST != 0 {
tcp_header.rst = true;
}
if flags & FIN != 0 {
tcp_header.fin = true;
}
if flags & PSH != 0 {
tcp_header.psh = true;
}
tcp_header.syn = flags & SYN != 0;
tcp_header.ack = flags & ACK != 0;
tcp_header.rst = flags & RST != 0;
tcp_header.fin = flags & FIN != 0;
tcp_header.psh = flags & PSH != 0;


let ip_header = match (self.dst_addr.ip(), self.src_addr.ip()) {
(std::net::IpAddr::V4(dst), std::net::IpAddr::V4(src)) => {
Expand Down

0 comments on commit 755f807

Please sign in to comment.