dynamic timeouts and minor cleanups

This commit is contained in:
Green Sky 2023-03-12 01:26:23 +01:00
parent cd6141ee00
commit 086fc52e92
No known key found for this signature in database
6 changed files with 5 additions and 11 deletions

View File

@ -54,9 +54,7 @@ $ tox_ngc_ft1_tool
FT1:
--ft_ack_per_packet
--ft_init_retry_timeout_after
--ft_sending_resend_without_ack_after
--ft_sending_give_up_after
--ft_packet_window_size
transfer logic:
-I <max_incoming_transfers>

@ -1 +1 @@
Subproject commit e1b5dd20804503668572edf15ef1b2db2b1847b3
Subproject commit 95bfa2473c30c8a43e29199621398f1d4bb76ef4

View File

@ -119,9 +119,7 @@ CommandLine::CommandLine(int argc, char** argv) {
std::cout << "CL set tox_port to " << tox_port << "\n";
} else if (parser.parseParam("--ft_ack_per_packet", ft_acks_per_packet)) {
} else if (parser.parseParam("--ft_init_retry_timeout_after", ft_init_retry_timeout_after)) {
} else if (parser.parseParam("--ft_sending_resend_without_ack_after", ft_sending_resend_without_ack_after)) {
} else if (parser.parseParam("--ft_sending_give_up_after", ft_sending_give_up_after)) {
} else if (parser.parseParam("--ft_packet_window_size", ft_packet_window_size)) {
} else if (parser.parseParam("-I", max_incoming_transfers)) {
} else if (parser.parseParam("-O", max_outgoing_transfers)) {
} else {

View File

@ -60,12 +60,8 @@ struct CommandLine {
size_t ft_acks_per_packet {3};
// --ft_init_retry_timeout_after
float ft_init_retry_timeout_after {5.f};
// --ft_sending_resend_without_ack_after
float ft_sending_resend_without_ack_after {3.f};
// --ft_sending_give_up_after
float ft_sending_give_up_after {30.f};
// --ft_packet_window_size
size_t ft_packet_window_size {8};
// ---- TODO ----

View File

@ -168,6 +168,10 @@ bool SHA1::iterate(float delta) {
const auto [group_number, peer_number, chunk_hash, _] = _queue_requested_chunk.front();
if (_tcl.getGroupPeerConnectionStatus(group_number, peer_number) != TOX_CONNECTION_NONE) {
if (!chunkIndex(chunk_hash).has_value()) {
std::cerr << "!chunkIndex(chunk_hash).has_value()\n";
exit(1);
}
size_t chunk_index = chunkIndex(chunk_hash).value();
size_t chunk_file_size = chunkSize(chunk_index);

View File

@ -124,9 +124,7 @@ ToxClient::ToxClient(const CommandLine& cl) :
NGC_FT1_options ft1_options {};
ft1_options.acks_per_packet = cl.ft_acks_per_packet;
ft1_options.init_retry_timeout_after = cl.ft_init_retry_timeout_after;
ft1_options.sending_resend_without_ack_after = cl.ft_sending_resend_without_ack_after;
ft1_options.sending_give_up_after = cl.ft_sending_give_up_after;
ft1_options.packet_window_size = cl.ft_packet_window_size;
_ft1_ctx = NGC_FT1_new(&ft1_options);
NGC_FT1_register_ext(_ft1_ctx, _ext_ctx);