mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Kernel: Minor cleanup in TCPSocket::send_tcp_packet()
This commit is contained in:
parent
f1f928670e
commit
340b524c0d
Notes:
sideshowbarker
2024-07-19 11:39:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/340b524c0d2
1 changed files with 12 additions and 11 deletions
|
@ -162,19 +162,20 @@ void TCPSocket::send_tcp_packet(u16 flags, const void* payload, int payload_size
|
|||
tcp_packet.set_checksum(compute_tcp_checksum(local_address(), peer_address(), tcp_packet, payload_size));
|
||||
|
||||
if (tcp_packet.has_syn() || payload_size > 0) {
|
||||
m_not_acked.append({ m_sequence_number, buffer, 0, {} });
|
||||
m_not_acked.append({ m_sequence_number, move(buffer), 0, {} });
|
||||
send_outgoing_packets();
|
||||
} else {
|
||||
auto routing_decision = route_to(peer_address(), local_address());
|
||||
ASSERT(!routing_decision.is_zero());
|
||||
|
||||
routing_decision.adapter->send_ipv4(
|
||||
routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
|
||||
buffer.data(), buffer.size(), ttl());
|
||||
|
||||
m_packets_out++;
|
||||
m_bytes_out += buffer.size();
|
||||
return;
|
||||
}
|
||||
|
||||
auto routing_decision = route_to(peer_address(), local_address());
|
||||
ASSERT(!routing_decision.is_zero());
|
||||
|
||||
routing_decision.adapter->send_ipv4(
|
||||
routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
|
||||
buffer.data(), buffer.size(), ttl());
|
||||
|
||||
m_packets_out++;
|
||||
m_bytes_out += buffer.size();
|
||||
}
|
||||
|
||||
void TCPSocket::send_outgoing_packets()
|
||||
|
|
Loading…
Reference in a new issue