From 869297a6725d1a82d36a5047a4bf9500a1202d9c Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 13 Dec 2017 02:00:09 +0100 Subject: [PATCH] nic_router: avoid "close" where we mean "dissolve" In the context of link state objects we often used the term "close" were we actually meant "dissolve". The term "close" originated from the TCP connection state and is still used in TCP links in the correct manner. Issue #2609 --- repos/os/src/server/nic_router/interface.cc | 26 ++++++++++----------- repos/os/src/server/nic_router/interface.h | 6 ++--- repos/os/src/server/nic_router/link.cc | 14 +++++------ repos/os/src/server/nic_router/link.h | 10 ++++---- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 3e9985a2c5..ab14a15678 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -31,11 +31,11 @@ using namespace Genode; ***************/ template -static void _destroy_closed_links(Link_list &closed_links, - Deallocator &dealloc) +static void _destroy_dissolved_links(Link_list &dissolved_links, + Deallocator &dealloc) { - while (Link *link = closed_links.first()) { - closed_links.remove(link); + while (Link *link = dissolved_links.first()) { + dissolved_links.remove(link); destroy(dealloc, static_cast(link)); } } @@ -43,10 +43,10 @@ static void _destroy_closed_links(Link_list &closed_links, template static void _destroy_links(Link_list &links, - Link_list &closed_links, + Link_list &dissolved_links, Deallocator &dealloc) { - _destroy_closed_links(closed_links, dealloc); + _destroy_dissolved_links(dissolved_links, dealloc); while (Link *link = links.first()) { link->dissolve(); links.remove(link); @@ -225,11 +225,11 @@ Link_list &Interface::links(L3_protocol const protocol) } -Link_list &Interface::closed_links(L3_protocol const protocol) +Link_list &Interface::dissolved_links(L3_protocol const protocol) { switch (protocol) { - case L3_protocol::TCP: return _closed_tcp_links; - case L3_protocol::UDP: return _closed_udp_links; + case L3_protocol::TCP: return _dissolved_tcp_links; + case L3_protocol::UDP: return _dissolved_udp_links; default: throw Bad_transport_protocol(); } } @@ -863,8 +863,8 @@ void Interface::_handle_eth(void *const eth_base, Packet_descriptor const &pkt) { /* do garbage collection over transport-layer links and DHCP allocations */ - _destroy_closed_links(_closed_udp_links, _alloc); - _destroy_closed_links(_closed_tcp_links, _alloc); + _destroy_dissolved_links(_dissolved_udp_links, _alloc); + _destroy_dissolved_links(_dissolved_tcp_links, _alloc); _destroy_released_dhcp_allocations(); /* inspect and handle ethernet frame */ @@ -997,8 +997,8 @@ Interface::~Interface() cancel_arp_waiting(*_own_arp_waiters.first()->object()); } /* destroy links */ - _destroy_links(_tcp_links, _closed_tcp_links, _alloc); - _destroy_links(_udp_links, _closed_udp_links, _alloc); + _destroy_links(_tcp_links, _dissolved_tcp_links, _alloc); + _destroy_links(_udp_links, _dissolved_udp_links, _alloc); /* destroy DHCP allocations */ _destroy_released_dhcp_allocations(); diff --git a/repos/os/src/server/nic_router/interface.h b/repos/os/src/server/nic_router/interface.h index 17b196384c..7936423400 100644 --- a/repos/os/src/server/nic_router/interface.h +++ b/repos/os/src/server/nic_router/interface.h @@ -66,8 +66,8 @@ class Net::Interface : public Genode::List::Element Arp_waiter_list _own_arp_waiters; Link_list _tcp_links; Link_list _udp_links; - Link_list _closed_tcp_links; - Link_list _closed_udp_links; + Link_list _dissolved_tcp_links; + Link_list _dissolved_udp_links; Dhcp_allocation_tree _dhcp_allocations; Dhcp_allocation_list _released_dhcp_allocations; Dhcp_client _dhcp_client { _alloc, _timer, *this }; @@ -217,7 +217,7 @@ class Net::Interface : public Genode::List::Element void send(Ethernet_frame ð, Genode::size_t const eth_size); - Link_list &closed_links(L3_protocol const protocol); + Link_list &dissolved_links(L3_protocol const protocol); Link_list &links(L3_protocol const protocol); diff --git a/repos/os/src/server/nic_router/link.cc b/repos/os/src/server/nic_router/link.cc index e31b43b284..54e9111f78 100644 --- a/repos/os/src/server/nic_router/link.cc +++ b/repos/os/src/server/nic_router/link.cc @@ -121,13 +121,13 @@ Link::Link(Interface &cln_interface, Timer::Connection &timer, Configuration &config, L3_protocol const protocol, - Microseconds const close_timeout) + Microseconds const dissolve_timeout) : _config(config), _client_interface(cln_interface), _server_port_alloc(srv_port_alloc), - _close_timeout(timer, *this, &Link::_handle_close_timeout), - _close_timeout_us(close_timeout), + _dissolve_timeout(timer, *this, &Link::_handle_dissolve_timeout), + _dissolve_timeout_us(dissolve_timeout), _protocol(protocol), _client(cln_interface.domain(), cln_id, *this), _server(srv_domain, srv_id, *this) @@ -135,15 +135,15 @@ Link::Link(Interface &cln_interface, _client_interface.links(_protocol).insert(this); _client.domain().links(_protocol).insert(&_client); _server.domain().links(_protocol).insert(&_server); - _close_timeout.schedule(_close_timeout_us); + _dissolve_timeout.schedule(_dissolve_timeout_us); } -void Link::_handle_close_timeout(Duration) +void Link::_handle_dissolve_timeout(Duration) { dissolve(); _client_interface.links(_protocol).remove(this); - _client_interface.closed_links(_protocol).insert(this); + _client_interface.dissolved_links(_protocol).insert(this); } @@ -188,7 +188,7 @@ Tcp_link::Tcp_link(Interface &cln_interface, void Tcp_link::_fin_acked() { if (_server_fin_acked && _client_fin_acked) { - _close_timeout.schedule(Microseconds(config().tcp_max_segm_lifetime().value << 1)); + _dissolve_timeout.schedule(Microseconds(config().tcp_max_segm_lifetime().value << 1)); _closed = true; } } diff --git a/repos/os/src/server/nic_router/link.h b/repos/os/src/server/nic_router/link.h index f33819b5b6..4b9a14d435 100644 --- a/repos/os/src/server/nic_router/link.h +++ b/repos/os/src/server/nic_router/link.h @@ -128,15 +128,15 @@ class Net::Link : public Link_list::Element Configuration &_config; Interface &_client_interface; Pointer const _server_port_alloc; - Timer::One_shot_timeout _close_timeout; - Genode::Microseconds const _close_timeout_us; + Timer::One_shot_timeout _dissolve_timeout; + Genode::Microseconds const _dissolve_timeout_us; L3_protocol const _protocol; Link_side _client; Link_side _server; - void _handle_close_timeout(Genode::Duration); + void _handle_dissolve_timeout(Genode::Duration); - void _packet() { _close_timeout.schedule(_close_timeout_us); } + void _packet() { _dissolve_timeout.schedule(_dissolve_timeout_us); } public: @@ -150,7 +150,7 @@ class Net::Link : public Link_list::Element Timer::Connection &timer, Configuration &config, L3_protocol const protocol, - Genode::Microseconds const close_timeout); + Genode::Microseconds const dissolve_timeout); void dissolve();