| 1496 | } |
| 1497 | |
| 1498 | void node_impl::fetch_updated_peer_lists_loop() |
| 1499 | { |
| 1500 | VERIFY_CORRECT_THREAD(); |
| 1501 | |
| 1502 | std::list<peer_connection_ptr> original_active_peers(_active_connections.begin(), _active_connections.end()); |
| 1503 | for( const peer_connection_ptr& active_peer : original_active_peers ) |
| 1504 | { |
| 1505 | try |
| 1506 | { |
| 1507 | active_peer->send_message(address_request_message()); |
| 1508 | } |
| 1509 | catch ( const fc::canceled_exception& ) |
| 1510 | { |
| 1511 | throw; |
| 1512 | } |
| 1513 | catch (const fc::exception& e) |
| 1514 | { |
| 1515 | dlog("Caught exception while sending address request message to peer ${peer} : ${e}", |
| 1516 | ("peer", active_peer->get_remote_endpoint())("e", e)); |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | // this has nothing to do with updating the peer list, but we need to prune this list |
| 1521 | // at regular intervals, this is a fine place to do it. |
| 1522 | fc::time_point_sec oldest_failed_ids_to_keep(fc::time_point::now() - fc::minutes(15)); |
| 1523 | auto oldest_failed_ids_to_keep_iter = _recently_failed_items.get<peer_connection::timestamp_index>().lower_bound(oldest_failed_ids_to_keep); |
| 1524 | auto begin_iter = _recently_failed_items.get<peer_connection::timestamp_index>().begin(); |
| 1525 | _recently_failed_items.get<peer_connection::timestamp_index>().erase(begin_iter, oldest_failed_ids_to_keep_iter); |
| 1526 | |
| 1527 | if (!_node_is_shutting_down && !_fetch_updated_peer_lists_loop_done.canceled() ) |
| 1528 | _fetch_updated_peer_lists_loop_done = fc::schedule( [this](){ fetch_updated_peer_lists_loop(); }, |
| 1529 | fc::time_point::now() + fc::minutes(15), |
| 1530 | "fetch_updated_peer_lists_loop" ); |
| 1531 | } |
| 1532 | void node_impl::update_bandwidth_data(uint32_t bytes_read_this_second, uint32_t bytes_written_this_second) |
| 1533 | { |
| 1534 | VERIFY_CORRECT_THREAD(); |
nothing calls this directly
no test coverage detected