| 1402 | } |
| 1403 | |
| 1404 | void endpoint_manager_impl::resume() { |
| 1405 | std::vector<std::tuple<boost::asio::ip::address, uint16_t, bool, partition_id_t>> clients; |
| 1406 | std::vector<std::tuple<uint16_t, bool>> servers; |
| 1407 | |
| 1408 | { |
| 1409 | std::scoped_lock its_lock(endpoint_mutex_); |
| 1410 | |
| 1411 | // restart client endpoints |
| 1412 | |
| 1413 | for (const auto& [its_address, ports] : client_endpoints_) { |
| 1414 | for (const auto& [its_port, protocols] : ports) { |
| 1415 | for (const auto& [its_protocol, partitions] : protocols) { |
| 1416 | for (const auto& [its_partition, its_endpoint] : partitions) { |
| 1417 | clients.push_back(std::make_tuple(its_address, its_port, its_protocol, its_partition)); |
| 1418 | } |
| 1419 | } |
| 1420 | } |
| 1421 | } |
| 1422 | |
| 1423 | // restart server endpoints |
| 1424 | |
| 1425 | for (const auto& [its_port, protocols] : server_endpoints_) { |
| 1426 | for (const auto& [its_protocol, its_endpoint] : protocols) { |
| 1427 | servers.push_back(std::make_tuple(its_port, its_protocol)); |
| 1428 | } |
| 1429 | } |
| 1430 | } |
| 1431 | |
| 1432 | for (const auto& [its_address, its_port, its_protocol, its_partition] : clients) { |
| 1433 | std::shared_ptr<boardnet_endpoint> its_endpoint; |
| 1434 | |
| 1435 | { |
| 1436 | std::scoped_lock its_lock(endpoint_mutex_); |
| 1437 | |
| 1438 | const auto& ports = client_endpoints_.find(its_address); |
| 1439 | if (ports == client_endpoints_.end()) { |
| 1440 | continue; |
| 1441 | } |
| 1442 | |
| 1443 | const auto& protocols = ports->second.find(its_port); |
| 1444 | if (protocols == ports->second.end()) { |
| 1445 | continue; |
| 1446 | } |
| 1447 | |
| 1448 | const auto& partitions = protocols->second.find(its_protocol); |
| 1449 | if (partitions == protocols->second.end()) { |
| 1450 | continue; |
| 1451 | } |
| 1452 | |
| 1453 | const auto& endpoint = partitions->second.find(its_partition); |
| 1454 | if (endpoint == partitions->second.end()) { |
| 1455 | continue; |
| 1456 | } |
| 1457 | |
| 1458 | its_endpoint = endpoint->second; |
| 1459 | } |
| 1460 | |
| 1461 | // From here, there is the risk that this endpoint will be removed from |
no test coverage detected