From a2efba68e8fc25459ee524e31fc7228ee62d89ce Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Tue, 5 Nov 2019 12:56:37 +0100 Subject: [HICN-378] Add a maximum number of reattempts in face manager before entering face ignore mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id6f8cc958d3c50027475d72d80eed6b65ac0996b Signed-off-by: Jordan Augé --- ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'ctrl/facemgr/src/interfaces') diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c index 945b60af2..76edfec10 100644 --- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c +++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c @@ -238,11 +238,13 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) */ if (facelet_get_face(facelet, &face) < 0) { ERROR("Could not retrieve face from facelet"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR_FACE; } if (!data->s) { /* We are not connected to the forwarder */ + ret = -FACELET_ERROR_REASON_FORWARDER_OFFLINE; goto ERR; } @@ -260,6 +262,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_create(data->s, &hc_face); if (rc < 0) { ERROR("Failed to create face\n"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } INFO("Created face id=%d", hc_face.id); @@ -268,6 +271,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) int n = facelet_get_route_array(facelet, &route_array); if (n < 0) { ERROR("Failed to create default hICN/IPv4 route"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } if (n == 0) { @@ -326,7 +330,6 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) continue; } } - } break; @@ -338,6 +341,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_delete(data->s, &hc_face); if (rc < 0) { ERROR("Failed to delete face\n"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } break; @@ -351,10 +355,12 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_get(data->s, &hc_face, &face_found); if (rc < 0) { ERROR("Failed to find face\n"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } if (!face_found) { ERROR("Face to update has not been found"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } char conn_id_or_name[SYMBOLIC_NAME_LEN]; @@ -364,11 +370,13 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) face_state_t admin_state; if (facelet_get_admin_state(facelet, &admin_state) < 0) { ERROR("Failed to retrieve facelet admin state"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } if (hc_connection_set_admin_state(data->s, conn_id_or_name, admin_state) < 0) { ERROR("Failed to update admin state"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } INFO("Admin state updated"); @@ -378,16 +386,14 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) default: ERROR("Unknown event %s\n", facelet_event_str[facelet_get_event(facelet)]); /* Unsupported events */ + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } - face_free(face); - return ret; - ERR: face_free(face); ERR_FACE: - return -1; + return ret; } int hl_callback(interface_t * interface, int fd, void * unused) -- cgit 1.2.3-korg