summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-17 20:46:04 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-17 23:39:31 +0200
commit340b524c0d2e0db15eca9dd7d69ab3b1788b11c8 (patch)
tree3705456fedcd7eca8091ee65265d15bb2bf6cfc1 /Kernel
parentf1f928670e7e5e61bcf4031fd5bdfd2c132fb23a (diff)
downloadserenity-340b524c0d2e0db15eca9dd7d69ab3b1788b11c8.zip
Kernel: Minor cleanup in TCPSocket::send_tcp_packet()
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/TCPSocket.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index b82ab43389..8389cec31c 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -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());
+ return;
+ }
- routing_decision.adapter->send_ipv4(
- routing_decision.next_hop, peer_address(), IPv4Protocol::TCP,
- buffer.data(), buffer.size(), ttl());
+ auto routing_decision = route_to(peer_address(), local_address());
+ ASSERT(!routing_decision.is_zero());
- m_packets_out++;
- m_bytes_out += buffer.size();
- }
+ 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()