higher tickrate if open requests

(we expect an init soon and dont want to bounce around)
This commit is contained in:
Green Sky 2024-07-07 13:21:59 +02:00
parent b64a4ae31c
commit b068819069
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -216,7 +216,7 @@ SHA1_NGCFT1::SHA1_NGCFT1(
_neep.subscribe(this, NGCEXT_Event::FT1_BITSET);
}
void SHA1_NGCFT1::iterate(float delta) {
float SHA1_NGCFT1::iterate(float delta) {
std::cerr << "---------- new tick ----------\n";
// info builder queue
if (_info_builder_dirty) {
@ -438,6 +438,14 @@ void SHA1_NGCFT1::iterate(float delta) {
}
});
}
if (_peer_open_requests.empty()) {
return 2.f;
} else {
// pretty conservative and should be ajusted on a per peer, per delay basis
// seems to do the trick
return 0.05f;
}
}
bool SHA1_NGCFT1::onEvent(const Message::Events::MessageUpdated& e) {

View File

@ -101,7 +101,7 @@ class SHA1_NGCFT1 : public ToxEventI, public RegistryMessageModelEventI, public
NGCEXTEventProvider& neep
);
void iterate(float delta);
float iterate(float delta);
protected: // rmm events (actions)
bool onEvent(const Message::Events::MessageUpdated&) override;