From 71ac2b5b24e258c65d4690edfae4e94977ac2f16 Mon Sep 17 00:00:00 2001 From: Asias He Date: Wed, 21 Jan 2015 10:51:50 +0200 Subject: [PATCH] tcp: Rename tcp::send() Unlike tcp::tcb::send() and tcp::connection::send() which send tcp packets associated with tcb, tcp::send() only send packets associated without tcb. We have a bunch of send() functions, rename it to make the code more readable. --- net/tcp.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/tcp.hh b/net/tcp.hh index d573f05e9d..7be5520901 100644 --- a/net/tcp.hh +++ b/net/tcp.hh @@ -414,7 +414,7 @@ public: net::hw_features hw_features() { return _inet._inet.hw_features(); } void poll_tcb(ipaddr to, lw_shared_ptr tcb); private: - void send(ipaddr from, ipaddr to, packet p); + void send_packet_without_tcb(ipaddr from, ipaddr to, packet p); void respond_with_reset(tcp_hdr* rth, ipaddr local_ip, ipaddr foreign_ip); friend class listener; }; @@ -534,8 +534,10 @@ void tcp::received(packet p, ipaddr from, ipaddr to) { } } + +// Send packet does not belong to any tcb template -void tcp::send(ipaddr from, ipaddr to, packet p) { +void tcp::send_packet_without_tcb(ipaddr from, ipaddr to, packet p) { if (_queue_space.try_wait(p.len())) { // drop packets that do not fit the queue _inet.get_l2_dst_address(to).then([this, to, p = std::move(p)] (ethernet_address e_dst) mutable { _packetq.emplace_back(ipv4_traits::l4packet{to, std::move(p), e_dst, ip_protocol_num::tcp}); @@ -605,7 +607,7 @@ void tcp::respond_with_reset(tcp_hdr* rth, ipaddr local_ip, ipaddr f oi.tcp_hdr_len = sizeof(tcp_hdr); p.set_offload_info(oi); - send(local_ip, foreign_ip, std::move(p)); + send_packet_without_tcb(local_ip, foreign_ip, std::move(p)); } template