| 1163 | } |
| 1164 | } |
| 1165 | void node_impl::bandwidth_monitor_loop() |
| 1166 | { |
| 1167 | VERIFY_CORRECT_THREAD(); |
| 1168 | fc::time_point_sec current_time = fc::time_point::now(); |
| 1169 | |
| 1170 | if (_bandwidth_monitor_last_update_time == fc::time_point_sec::min()) |
| 1171 | _bandwidth_monitor_last_update_time = current_time; |
| 1172 | |
| 1173 | uint32_t seconds_since_last_update = current_time.sec_since_epoch() |
| 1174 | - _bandwidth_monitor_last_update_time.sec_since_epoch(); |
| 1175 | seconds_since_last_update = std::max(UINT32_C(1), seconds_since_last_update); |
| 1176 | uint32_t bytes_read_this_second = _rate_limiter.get_actual_download_rate(); |
| 1177 | uint32_t bytes_written_this_second = _rate_limiter.get_actual_upload_rate(); |
| 1178 | for (uint32_t i = 0; i < seconds_since_last_update - 1; ++i) |
| 1179 | update_bandwidth_data(0, 0); |
| 1180 | update_bandwidth_data(bytes_read_this_second, bytes_written_this_second); |
| 1181 | _bandwidth_monitor_last_update_time = current_time; |
| 1182 | |
| 1183 | if (!_node_is_shutting_down && !_bandwidth_monitor_loop_done.canceled()) |
| 1184 | _bandwidth_monitor_loop_done = fc::schedule( [=](){ bandwidth_monitor_loop(); }, |
| 1185 | fc::time_point::now() + fc::seconds(1), |
| 1186 | "bandwidth_monitor_loop" ); |
| 1187 | } |
| 1188 | |
| 1189 | void node_impl::dump_node_status_task() |
| 1190 | { |
nothing calls this directly
no outgoing calls
no test coverage detected