diff options
author | Jordan Augé <jordan.auge@cisco.com> | 2019-10-30 17:56:08 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge@cisco.com> | 2019-10-31 13:41:47 +0100 |
commit | 95170bf3a69597b49238bb7ff396d41f6dc94f30 (patch) | |
tree | 2f9b565e84514d7ee25cfd874235dd25e9300a0f /ctrl/facemgr/src/util | |
parent | fc6dfe9f7ee02834ae1e6f56e0aaee36ac3e88dd (diff) |
[HICN-369] Implement reconciliation state machine in face manager incl. reattempts in case of errors
Change-Id: Ia4ecf621fbd513d9e29313d2aaa487aa65811183
Signed-off-by: Jordan Augé <jordan.auge@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/util')
-rw-r--r-- | ctrl/facemgr/src/util/map.h | 10 | ||||
-rw-r--r-- | ctrl/facemgr/src/util/set.h | 14 |
2 files changed, 23 insertions, 1 deletions
diff --git a/ctrl/facemgr/src/util/map.h b/ctrl/facemgr/src/util/map.h index b113954a6..19a308d86 100644 --- a/ctrl/facemgr/src/util/map.h +++ b/ctrl/facemgr/src/util/map.h @@ -108,6 +108,16 @@ NAME ## _initialize(NAME ## _t * map) int \ NAME ## _finalize(NAME ## _t * map) \ { \ + NAME ## _pair_t ** array; \ + int n = NAME ## _pair_set_get_array(&map->pair_set, &array); \ + if (n < 0) \ + return -1; \ + for (unsigned i = 0; i < n; i++) { \ + NAME ## _pair_t * pair = array[i]; \ + NAME ## _pair_set_remove(&map->pair_set, pair, NULL); \ + NAME ## _pair_free(pair); \ + } \ + free(array); \ return NAME ## _pair_set_finalize(&map->pair_set); \ } \ \ diff --git a/ctrl/facemgr/src/util/set.h b/ctrl/facemgr/src/util/set.h index 0dad17423..b9d66c16e 100644 --- a/ctrl/facemgr/src/util/set.h +++ b/ctrl/facemgr/src/util/set.h @@ -96,7 +96,19 @@ NAME ## _initialize(NAME ## _t * set) \ } \ \ int \ -NAME ## _finalize(NAME ## _t * set) { return 0; } \ +NAME ## _finalize(NAME ## _t * set) \ +{ \ + T * array; \ + int n = NAME ## _get_array(set, &array); \ + if (n < 0) \ + return -1; \ + for (unsigned i = 0; i < n; i++) { \ + T element = array[i]; \ + NAME ## _remove(set, element, NULL); \ + } \ + free(array); \ + return 0; \ +} \ \ NAME ## _t * \ NAME ## _create() \ |