more strict sending

This commit is contained in:
Green Sky 2023-01-22 17:21:03 +01:00
parent de247c9e91
commit e0d4c4d1e1
No known key found for this signature in database

View File

@ -145,6 +145,7 @@ bool SHA1::iterate(float delta) {
// send init to _queue_requested_info // send init to _queue_requested_info
const auto [group_number, peer_number] = _queue_requested_info.front(); const auto [group_number, peer_number] = _queue_requested_info.front();
if (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) != TOX_CONNECTION_NONE) {
uint8_t transfer_id {0}; uint8_t transfer_id {0};
if (_tcl.sendFT1InitPrivate( if (_tcl.sendFT1InitPrivate(
@ -162,9 +163,11 @@ bool SHA1::iterate(float delta) {
_queue_requested_info.pop_front(); _queue_requested_info.pop_front();
} }
}
} else if (!_queue_requested_chunk.empty()) { // then check for chunk requests } else if (!_queue_requested_chunk.empty()) { // then check for chunk requests
const auto [group_number, peer_number, chunk_hash, _] = _queue_requested_chunk.front(); const auto [group_number, peer_number, chunk_hash, _] = _queue_requested_chunk.front();
if (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) != TOX_CONNECTION_NONE) {
size_t chunk_index = chunkIndex(chunk_hash).value(); size_t chunk_index = chunkIndex(chunk_hash).value();
size_t chunk_file_size = chunkSize(chunk_index); size_t chunk_file_size = chunkSize(chunk_index);
@ -188,6 +191,7 @@ bool SHA1::iterate(float delta) {
} }
} }
} }
}
// update speeds and targets // update speeds and targets
_peer_speed_mesurement_interval_timer += delta; _peer_speed_mesurement_interval_timer += delta;
@ -284,6 +288,7 @@ bool SHA1::iterate(float delta) {
float up_kibs {(bytes_up_since / 1024.f) / log_interval}; float up_kibs {(bytes_up_since / 1024.f) / log_interval};
float down_kibs {(bytes_down_since / 1024.f) / log_interval}; float down_kibs {(bytes_down_since / 1024.f) / log_interval};
std::cout << std::string(40, '-') << "\n";
std::cout << "SHA1 speed down: " << down_kibs << "KiB/s up: " << up_kibs << "KiB/s\n"; std::cout << "SHA1 speed down: " << down_kibs << "KiB/s up: " << up_kibs << "KiB/s\n";
std::cout << "SHA1 total down: " << _bytes_down / 1024 << "KiB up: " << _bytes_up / 1024 << "KiB\n"; std::cout << "SHA1 total down: " << _bytes_down / 1024 << "KiB up: " << _bytes_up / 1024 << "KiB\n";
@ -297,6 +302,7 @@ bool SHA1::iterate(float delta) {
<< " " << speed / 1024.f << "KiB/s\n" << " " << speed / 1024.f << "KiB/s\n"
; ;
} }
std::cout << std::string(40, '-') << "\n";
} }
// TODO: unmap and remap the file every couple of minutes to keep ram usage down? // TODO: unmap and remap the file every couple of minutes to keep ram usage down?