expose more parameters and refactor cl
This commit is contained in:
@@ -5,9 +5,6 @@
|
||||
|
||||
#include "./states/send_start_sha1.hpp"
|
||||
#include "./states/receive_start_sha1.hpp"
|
||||
#include "ngc_ft1.h"
|
||||
#include "tox/tox.h"
|
||||
#include "toxcore/tox.h"
|
||||
|
||||
#include <memory>
|
||||
#include <sodium.h>
|
||||
@@ -124,6 +121,11 @@ ToxClient::ToxClient(const CommandLine& cl) :
|
||||
_ext_ctx = NGC_EXT_new();
|
||||
|
||||
NGC_FT1_options ft1_options {};
|
||||
ft1_options.acks_per_packet = 5;
|
||||
ft1_options.init_retry_timeout_after = 10.f;
|
||||
ft1_options.sending_resend_without_ack_after = 5.f;
|
||||
ft1_options.sending_give_up_after = 30.f;
|
||||
ft1_options.packet_window_size = 10;
|
||||
_ft1_ctx = NGC_FT1_new(&ft1_options);
|
||||
NGC_FT1_register_ext(_ft1_ctx, _ext_ctx);
|
||||
|
||||
@@ -195,11 +197,13 @@ ToxClient::~ToxClient(void) {
|
||||
}
|
||||
|
||||
bool ToxClient::iterate(void) {
|
||||
tox_iterate(_tox, this);
|
||||
NGC_FT1_iterate(_tox, _ft1_ctx);
|
||||
|
||||
// HACK: hardcoded 5ms sleep in main
|
||||
if (_state->iterate(0.005f)) {
|
||||
float time_delta {0.005f};
|
||||
|
||||
tox_iterate(_tox, this);
|
||||
NGC_FT1_iterate(_tox, _ft1_ctx, time_delta);
|
||||
|
||||
if (_state->iterate(time_delta)) {
|
||||
_state = _state->nextState();
|
||||
|
||||
if (!_state) {
|
||||
|
||||
Reference in New Issue
Block a user