Second phase of address cache refactoring:

1. Added time to live functionality
2. Added option of partial cache init on reset to reduce traffic for controllers that can preserve RAM over power cycle/reset.
3. Can now put new entries in the cache even if it is full - entry nearest to expiry is dropped to make room.
This commit is contained in:
petermcs
2009-10-16 19:27:35 +00:00
parent 0f28f99ade
commit 694abdeb4e
3 changed files with 250 additions and 22 deletions
+4 -1
View File
@@ -411,6 +411,7 @@ int main(
putchar('.'); /* Just to show that time is passing... */
last_seconds = current_seconds;
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
address_cache_timer(current_seconds - last_seconds);
}
if(_kbhit()) {
@@ -442,8 +443,10 @@ int main(
npdu_handler(&src, &Rx_Buf[0], pdu_len);
}
/* at least one second has passed */
if (current_seconds != last_seconds)
if (current_seconds != last_seconds) {
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
address_cache_timer(current_seconds - last_seconds);
}
if (Error_Detected)
break;
/* wait until the device is bound, or timeout and quit */