mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
gtphub: cosmetic/prepare: add nr_map_refresh().
Sponsored-by: On-Waves ehi
This commit is contained in:
@@ -307,6 +307,11 @@ void nr_map_init(struct nr_map *map, struct nr_pool *pool,
|
||||
void nr_map_add(struct nr_map *map, struct nr_mapping *mapping,
|
||||
time_t now);
|
||||
|
||||
/* Restart the timeout for the given mapping. mapping must be a member of map.
|
||||
*/
|
||||
void nr_map_refresh(struct nr_map *map, struct nr_mapping *mapping,
|
||||
time_t now);
|
||||
|
||||
/* Return a known mapping from nr_orig and the given origin. If nr_orig is
|
||||
* unknown, return NULL. */
|
||||
struct nr_mapping *nr_map_get(const struct nr_map *map,
|
||||
|
@@ -660,10 +660,16 @@ void nr_map_add(struct nr_map *map, struct nr_mapping *mapping, time_t now)
|
||||
/* Add to the tail to always yield a list sorted by expiry, in
|
||||
* ascending order. */
|
||||
llist_add_tail(&mapping->entry, &map->mappings);
|
||||
if (map->add_items_to_expiry)
|
||||
expiry_add(map->add_items_to_expiry,
|
||||
&mapping->expiry_entry,
|
||||
now);
|
||||
nr_map_refresh(map, mapping, now);
|
||||
}
|
||||
|
||||
void nr_map_refresh(struct nr_map *map, struct nr_mapping *mapping, time_t now)
|
||||
{
|
||||
if (!map->add_items_to_expiry)
|
||||
return;
|
||||
expiry_add(map->add_items_to_expiry,
|
||||
&mapping->expiry_entry,
|
||||
now);
|
||||
}
|
||||
|
||||
void nr_map_clear(struct nr_map *map)
|
||||
@@ -1010,9 +1016,7 @@ static struct nr_mapping *gtphub_mapping_have(struct nr_map *map,
|
||||
gtphub_port_str(from),
|
||||
(int)(nrm->orig), (int)(nrm->repl));
|
||||
} else {
|
||||
/* restart expiry timeout */
|
||||
expiry_add(map->add_items_to_expiry, &nrm->expiry_entry,
|
||||
now);
|
||||
nr_map_refresh(map, nrm, now);
|
||||
}
|
||||
|
||||
OSMO_ASSERT(nrm);
|
||||
|
Reference in New Issue
Block a user