Skip to content

Commit 9074391

Browse files
joelpintoDuarte Fonseca
authored andcommitted
Allow daemon to send ADD_CLIENT to connected clients
Summary Allow daemon to send ADD_CLIENT to already connected clients. Details During STR, connected clients might handle partner client errors due to lost of connectivity (tcp keep-alive), when handling error, the client removes the partner from its list of known clients. On resume, these clients will receive the service availability and subscriptions and etc but will not respond as they are unable to create tcp sockets to communicate with other client as it is not in the known client list. To be in the known client list, an application needs to receive an ADD_CLIENT routing info command from the daemon when an application either requests or registers events, the daemon did not sent the message as both clients were already already connected according to the host connection matrix map. To fix this issue, this PR proposes the removal of the is_connected check when handling of requests or offers, without it, application will always be notified independent of the connection matrix state.
1 parent 1b11459 commit 9074391

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

implementation/routing/src/routing_manager_stub.cpp

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,18 +1427,16 @@ void routing_manager_stub::inform_requesters(client_t _hoster, service_t _servic
14271427
if (_inform_service) {
14281428
if (_hoster != VSOMEIP_ROUTING_CLIENT &&
14291429
_hoster != host_->get_client()) {
1430-
if (!is_connected(_hoster, its_client.first)) {
1431-
add_connection(_hoster, its_client.first);
1432-
protocol::routing_info_entry its_entry;
1433-
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
1434-
its_entry.set_client(its_client.first);
1435-
if (host_->get_guest(its_client.first, its_address, its_port)) {
1436-
its_entry.set_address(its_address);
1437-
its_entry.set_port(its_port);
1438-
}
1439-
send_client_routing_info(_hoster, its_entry);
1440-
send_client_config_command(its_client.first, _hoster);
1430+
add_connection(_hoster, its_client.first);
1431+
protocol::routing_info_entry its_entry;
1432+
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
1433+
its_entry.set_client(its_client.first);
1434+
if (host_->get_guest(its_client.first, its_address, its_port)) {
1435+
its_entry.set_address(its_address);
1436+
its_entry.set_port(its_port);
14411437
}
1438+
send_client_routing_info(_hoster, its_entry);
1439+
send_client_config_command(its_client.first, _hoster);
14421440
}
14431441
}
14441442
if (its_client.first != VSOMEIP_ROUTING_CLIENT &&
@@ -2106,24 +2104,21 @@ void routing_manager_stub::handle_requests(const client_t _client, std::set<prot
21062104
// insert VSOMEIP_ROUTING_CLIENT to check whether service is remotely offered
21072105
its_clients.insert(VSOMEIP_ROUTING_CLIENT);
21082106
for (const client_t c : its_clients) {
2109-
if (c != VSOMEIP_ROUTING_CLIENT &&
2110-
c != host_->get_client()) {
2111-
if (!is_connected(c, _client)) {
2112-
add_connection(c, _client);
2107+
if (c != VSOMEIP_ROUTING_CLIENT && c != host_->get_client()) {
2108+
add_connection(c, _client);
21132109

2114-
protocol::routing_info_entry its_entry;
2115-
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
2116-
its_entry.set_client(_client);
2117-
if (host_->get_guest(_client, its_address, its_port)) {
2118-
its_entry.set_address(its_address);
2119-
its_entry.set_port(its_port);
2120-
}
2121-
if (_client == c) {
2122-
its_entries.emplace_back(its_entry);
2123-
} else {
2124-
send_client_routing_info(c, its_entry);
2125-
send_client_config_command(_client, c);
2126-
}
2110+
protocol::routing_info_entry its_entry;
2111+
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
2112+
its_entry.set_client(_client);
2113+
if (host_->get_guest(_client, its_address, its_port)) {
2114+
its_entry.set_address(its_address);
2115+
its_entry.set_port(its_port);
2116+
}
2117+
if (_client == c) {
2118+
its_entries.emplace_back(its_entry);
2119+
} else {
2120+
send_client_routing_info(c, its_entry);
2121+
send_client_config_command(_client, c);
21272122
}
21282123
}
21292124
if (_client != VSOMEIP_ROUTING_CLIENT && _client != host_->get_client()) {
@@ -2158,22 +2153,20 @@ void routing_manager_stub::handle_requests(const client_t _client, std::set<prot
21582153
const auto found_instance = found_service->second.find(request.instance_);
21592154
if (found_instance != found_service->second.end()) {
21602155
if (c != VSOMEIP_ROUTING_CLIENT && c != host_->get_client()) {
2161-
if (!is_connected(c, _client)) {
2162-
add_connection(c, _client);
2156+
add_connection(c, _client);
21632157

2164-
protocol::routing_info_entry its_entry;
2165-
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
2166-
its_entry.set_client(_client);
2167-
if (host_->get_guest(_client, its_address, its_port)) {
2168-
its_entry.set_address(its_address);
2169-
its_entry.set_port(its_port);
2170-
}
2171-
if (_client == c) {
2172-
its_entries.emplace_back(its_entry);
2173-
} else {
2174-
send_client_routing_info(c, its_entry);
2175-
send_client_config_command(_client, c);
2176-
}
2158+
protocol::routing_info_entry its_entry;
2159+
its_entry.set_type(protocol::routing_info_entry_type_e::RIE_ADD_CLIENT);
2160+
its_entry.set_client(_client);
2161+
if (host_->get_guest(_client, its_address, its_port)) {
2162+
its_entry.set_address(its_address);
2163+
its_entry.set_port(its_port);
2164+
}
2165+
if (_client == c) {
2166+
its_entries.emplace_back(its_entry);
2167+
} else {
2168+
send_client_routing_info(c, its_entry);
2169+
send_client_config_command(_client, c);
21772170
}
21782171
}
21792172
if (_client != VSOMEIP_ROUTING_CLIENT && _client != host_->get_client()) {

0 commit comments

Comments
 (0)