| 923 | } |
| 924 | |
| 925 | bool 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 | |
| 950 | void 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) { |
no test coverage detected