Compare commits

...

3 Commits

Author SHA1 Message Date
Ben Meadors
a429df4cda Update src/modules/NodeInfoModule.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-19 18:21:04 -06:00
Ben Meadors
67f9f74509 Shorter timeout still needed for pubkey unkown and ad-hoc send 2026-01-19 18:11:28 -06:00
Ben Meadors
733eb3a961 Implement graduated scaling for NodeInfo send timeout based on active mesh size 2026-01-19 17:11:54 -06:00

View File

@@ -2,6 +2,7 @@
#include "Default.h" #include "Default.h"
#include "MeshService.h" #include "MeshService.h"
#include "NodeDB.h" #include "NodeDB.h"
#include "NodeStatus.h"
#include "RTC.h" #include "RTC.h"
#include "Router.h" #include "Router.h"
#include "configuration.h" #include "configuration.h"
@@ -129,14 +130,17 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
LOG_DEBUG("Skip send NodeInfo > 40%% ch. util"); LOG_DEBUG("Skip send NodeInfo > 40%% ch. util");
return NULL; return NULL;
} }
// If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway.
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) { // Use graduated scaling based on active mesh size (10 minute base, scales with congestion coefficient)
LOG_DEBUG("Skip send NodeInfo since we sent it <5min ago"); uint32_t timeoutMs = Default::getConfiguredOrDefaultMsScaled(0, 10 * 60, nodeStatus->getNumOnline());
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, timeoutMs)) {
LOG_DEBUG("Skip send NodeInfo since we sent it <%us ago", timeoutMs / 1000);
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) { } else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
// For interactive/urgent requests (e.g., user-triggered or implicit requests), use a shorter 60s timeout
LOG_DEBUG("Skip send NodeInfo since we sent it <60s ago"); LOG_DEBUG("Skip send NodeInfo since we sent it <60s ago");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true;
return NULL; return NULL;
} else { } else {
ignoreRequest = false; // Don't ignore requests anymore ignoreRequest = false; // Don't ignore requests anymore