diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2023-01-18 18:18:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 18:18:36 +0100 |
commit | 1b98bec0abb61fb86180a13869434da8519bd261 (patch) | |
tree | fce6f0e35e87b1f7027d319e5645b0907e3fde94 /src/lib/protocols/ookla.c | |
parent | de24206adccf2347addc05d6d62b3bf743fef411 (diff) |
LRU caches: add a generic (optional and configurable) expiration logic (#1855)
Two caches already implemented a similar mechanism: make it generic.
Diffstat (limited to 'src/lib/protocols/ookla.c')
-rw-r--r-- | src/lib/protocols/ookla.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/protocols/ookla.c b/src/lib/protocols/ookla.c index 137b0a2a3..f9a7a2d94 100644 --- a/src/lib/protocols/ookla.c +++ b/src/lib/protocols/ookla.c @@ -63,7 +63,7 @@ void ndpi_search_ookla(struct ndpi_detection_module_struct* ndpi_struct, struct #ifdef OOKLA_DEBUG printf("=>>>>>>>> [OOKLA IPv6] Adding %u\n", h); #endif - ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, h, 1 /* dummy */); + ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, h, 1 /* dummy */, ndpi_get_current_time(flow)); } return; } else { @@ -79,7 +79,8 @@ void ndpi_search_ookla(struct ndpi_detection_module_struct* ndpi_struct, struct printf("=>>>>>>>> [OOKLA IPv6] Searching %u\n", h); #endif - if(ndpi_lru_find_cache(ndpi_struct->ookla_cache, h, &dummy, 0 /* Don't remove it as it can be used for other connections */)) { + if(ndpi_lru_find_cache(ndpi_struct->ookla_cache, h, &dummy, 0 /* Don't remove it as it can be used for other connections */, + ndpi_get_current_time(flow))) { NDPI_LOG_INFO(ndpi_struct, "found ookla tcp connection\n"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OOKLA, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI_CACHE); #ifdef OOKLA_DEBUG @@ -110,7 +111,8 @@ void ndpi_search_ookla(struct ndpi_detection_module_struct* ndpi_struct, struct if(ndpi_struct->ookla_cache != NULL) { u_int16_t dummy; - if(ndpi_lru_find_cache(ndpi_struct->ookla_cache, addr, &dummy, 0 /* Don't remove it as it can be used for other connections */)) { + if(ndpi_lru_find_cache(ndpi_struct->ookla_cache, addr, &dummy, 0 /* Don't remove it as it can be used for other connections */, + ndpi_get_current_time(flow))) { NDPI_LOG_INFO(ndpi_struct, "found ookla tcp connection\n"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OOKLA, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI_CACHE); #ifdef OOKLA_DEBUG |