Start a cold measurement when automatic detection is enabled

This commit is contained in:
evgeny committed 2026-10-12 20:31:45 +02:00
1 parent 406f569989
commit 61e3ad9d24
2 files changed
+11

No files matched your search

+9
View File
@@ -1514,6 +1514,15 @@ void nat_detection_set_allow_local(struct NAT_DETECTION *detector, int allow) {
void nat_detection_set_automatic(struct NAT_DETECTION *detector, int automatic) {
if (!detector) return;
if (automatic && !detector->automatic) {
uint64_t now = get_time_tb();
for (struct nat_socket *state = detector->sockets; state; state = state->next) {
if (state->phase || state->cycling ||
(state->measured_profile.source == ADDRESS_SOURCE_ETCP && state->measured_profile.mapping && state->measured_profile.inbound))
continue;
state->cold_until = now + NAT_ROUND_TB + 2500; state->due = now + 2500;
}
}
detector->automatic = !!automatic;
detector->reservation_dirty = 1;
DEBUG_INFO(DEBUG_CATEGORY_NAT, "NAT automatic endpoint measurements %s", automatic ? "enabled" : "disabled");