MCPcopy Create free account
hub / github.com/COVESA/vsomeip / on_bind_error

Method on_bind_error

implementation/endpoints/src/endpoint_manager_impl.cpp:925–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

923}
924
925bool endpoint_manager_impl::on_bind_error(std::shared_ptr<boardnet_endpoint> _endpoint, const boost::asio::ip::address& _remote_address,
926 std::uint16_t _remote_port, uint16_t& _local_port) {
927
928 std::scoped_lock its_ep_lock{endpoint_mutex_};
929 for (auto& [its_si, its_reliability_map] : remote_services_) {
930 const bool is_reliable = _endpoint->is_reliable();
931 if (auto found_endpoint = its_reliability_map.find(is_reliable); found_endpoint != its_reliability_map.end()) {
932 if (found_endpoint->second == _endpoint) {
933 // get a new client port using service / instance / remote port
934 uint16_t its_old_local_port = _endpoint->get_local_port();
935 _local_port = ILLEGAL_PORT; // will be given as a new local port
936
937 std::map<bool, std::set<port_t>> its_used_client_ports;
938 get_used_client_ports(_remote_address, _remote_port, its_used_client_ports);
939 if (configuration_->get_client_port(its_si.service(), its_si.instance(), _remote_port, is_reliable, its_used_client_ports,
940 _local_port)) {
941 release_used_client_port(_remote_address, _remote_port, _endpoint->is_reliable(), its_old_local_port);
942 return true;
943 }
944 }
945 }
946 }
947 return false;
948}
949
950void endpoint_manager_impl::on_error(const byte_t* _data, length_t _length, boardnet_endpoint* const _receiver,
951 const boost::asio::ip::address& _remote_address, std::uint16_t _remote_port) {

Callers 2

connectMethod · 0.80
connectMethod · 0.80

Calls 6

endMethod · 0.80
get_client_portMethod · 0.80
instanceMethod · 0.80
is_reliableMethod · 0.45
get_local_portMethod · 0.45
serviceMethod · 0.45

Tested by

no test coverage detected