mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 18:06:50 +00:00
parent
3ced146733
commit
859a5fd208
@ -198,37 +198,13 @@ Interface::_new_link(L3_protocol const protocol,
|
||||
{
|
||||
switch (protocol) {
|
||||
case L3_protocol::TCP:
|
||||
{
|
||||
Tcp_link &link = *new (_alloc)
|
||||
Tcp_link(*this, local, remote_port_alloc, remote_domain,
|
||||
remote, _timer, _config(), protocol);
|
||||
|
||||
_tcp_links.insert(&link);
|
||||
_domain.tcp_links().insert(&link.client());
|
||||
remote_domain.tcp_links().insert(&link.server());
|
||||
if (_config().verbose()) {
|
||||
log("New TCP client link: ", link.client(), " at ", _domain);
|
||||
log("New TCP server link: ", link.server(),
|
||||
" at ", remote_domain);
|
||||
}
|
||||
return;
|
||||
}
|
||||
new (_alloc) Tcp_link(*this, local, remote_port_alloc, remote_domain,
|
||||
remote, _timer, _config(), protocol);
|
||||
break;
|
||||
case L3_protocol::UDP:
|
||||
{
|
||||
Udp_link &link = *new (_alloc)
|
||||
Udp_link(*this, local, remote_port_alloc, remote_domain,
|
||||
remote, _timer, _config(), protocol);
|
||||
|
||||
_udp_links.insert(&link);
|
||||
_domain.udp_links().insert(&link.client());
|
||||
remote_domain.udp_links().insert(&link.server());
|
||||
if (_config().verbose()) {
|
||||
log("New UDP client link: ", link.client(), " at ", _domain);
|
||||
log("New UDP server link: ", link.server(),
|
||||
" at ", remote_domain);
|
||||
}
|
||||
return;
|
||||
}
|
||||
new (_alloc) Udp_link(*this, local, remote_port_alloc, remote_domain,
|
||||
remote, _timer, _config(), protocol);
|
||||
break;
|
||||
default: throw Bad_transport_protocol(); }
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,12 @@ Link_side::Link_side(Domain &domain,
|
||||
Link &link)
|
||||
:
|
||||
_domain(domain), _id(id), _link(link)
|
||||
{ }
|
||||
{
|
||||
if (link.config().verbose()) {
|
||||
log("[", domain, "] New ", l3_protocol_name(link.protocol()),
|
||||
" link ", is_client() ? "client" : "server", ": ", *this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Link_side const &Link_side::find_by_id(Link_side_id const &id) const
|
||||
@ -119,14 +124,17 @@ Link::Link(Interface &cln_interface,
|
||||
Microseconds const close_timeout)
|
||||
:
|
||||
_config(config),
|
||||
_client(cln_interface.domain(), cln_id, *this),
|
||||
_client_interface(cln_interface),
|
||||
_server_port_alloc(srv_port_alloc),
|
||||
_server(srv_domain, srv_id, *this),
|
||||
_close_timeout(timer, *this, &Link::_handle_close_timeout),
|
||||
_close_timeout_us(close_timeout),
|
||||
_protocol(protocol)
|
||||
_protocol(protocol),
|
||||
_client(cln_interface.domain(), cln_id, *this),
|
||||
_server(srv_domain, srv_id, *this)
|
||||
{
|
||||
_client_interface.links(_protocol).insert(this);
|
||||
_client.domain().links(_protocol).insert(&_client);
|
||||
_server.domain().links(_protocol).insert(&_server);
|
||||
_close_timeout.schedule(_close_timeout_us);
|
||||
}
|
||||
|
||||
|
@ -126,13 +126,13 @@ class Net::Link : public Link_list::Element
|
||||
protected:
|
||||
|
||||
Configuration &_config;
|
||||
Link_side _client;
|
||||
Interface &_client_interface;
|
||||
Pointer<Port_allocator_guard> const _server_port_alloc;
|
||||
Link_side _server;
|
||||
Timer::One_shot_timeout<Link> _close_timeout;
|
||||
Genode::Microseconds const _close_timeout_us;
|
||||
L3_protocol const _protocol;
|
||||
Link_side _client;
|
||||
Link_side _server;
|
||||
|
||||
void _handle_close_timeout(Genode::Duration);
|
||||
|
||||
@ -166,9 +166,10 @@ class Net::Link : public Link_list::Element
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
Link_side &client() { return _client; }
|
||||
Link_side &server() { return _server; }
|
||||
Configuration &config() { return _config; }
|
||||
Link_side &client() { return _client; }
|
||||
Link_side &server() { return _server; }
|
||||
Configuration &config() { return _config; }
|
||||
L3_protocol protocol() const { return _protocol; }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user