summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/facemgr/src/api.c20
-rw-r--r--ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c2
-rw-r--r--ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c29
-rw-r--r--ctrl/libhicnctrl/src/api.c4
4 files changed, 19 insertions, 36 deletions
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index 01b6e52f3..18a25d6a1 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -549,26 +549,6 @@ facelet_cache_lookup(const facelet_set_t * facelet_cache, facelet_t * facelet,
facelet_t ***cached_facelets)
{
assert(facelet);
- if (!facelet_has_family(facelet))
- return 0;
-#if 0 // key is no more sufficient now that we support multiple faces per interface
- /*
- * If the facelet is uniquely identified by its key, it is used to perform
- * an efficient lookup directly...
- */
- if (facelet_has_key(facelet)) {
- facelet_t * found = NULL;
- if (facelet_set_get(facelet_cache, facelet, &found) < 0) {
- ERROR("[facelet_cache_lookup] Error during cache lookup");
- return -1;
- }
- if (!found)
- return 0;
- *cached_facelets = malloc(sizeof(facelet_t*));
- *cached_facelets[0] = found;
- return 1;
- }
-#endif
/* ...otherwise, we iterate over the facelet
* cache to find matching elements.
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
index 4ba4c5b1f..cb1a0040d 100644
--- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
+++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
@@ -449,7 +449,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet)
}
INFO("Admin state updated");
}
- if (facelet_get_admin_state_status(facelet) == FACELET_ATTR_STATUS_DIRTY) {
+ if (facelet_get_priority_status(facelet) == FACELET_ATTR_STATUS_DIRTY) {
hc_face.face = *face;
hc_face_t * face_found;
diff --git a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
index 5c5afdb6c..b8e7271bb 100644
--- a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
+++ b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
@@ -22,7 +22,7 @@ int priority_controller_initialize(interface_t * interface, void * cfg)
pc_data_t * data = malloc(sizeof(pc_data_t));
if (!data) {
INFO("Priority controller data memory allocation error");
- return -1;
+ goto ERR_MALLOC;
}
interface->data = data;
@@ -32,7 +32,7 @@ int priority_controller_initialize(interface_t * interface, void * cfg)
if (data->fd < 0) {
INFO("Priority controller socket error");
perror("socket error");
- return -1;
+ goto ERR_SOCKET;
}
memset(&addr, 0, sizeof(addr));
@@ -43,12 +43,23 @@ int priority_controller_initialize(interface_t * interface, void * cfg)
if (bind(data->fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
INFO("Priority controller socket bind error");
perror("bind error");
- return -1;
+ goto ERR_BIND;
+ }
+ if (interface_register_fd(interface, data->fd, NULL) < 0) {
+ ERROR("[priority_controller_initialize] Error registering fd");
+ goto ERR_FD;
}
- interface_register_fd(interface, data->fd, NULL);
INFO("Priority controller successfully initialized");
- return data->fd;
+ return 0;
+
+ERR_FD:
+ERR_BIND:
+ close(data->fd);
+ERR_SOCKET:
+ free(data);
+ERR_MALLOC:
+ return -1;
}
int priority_controller_finalize(interface_t * interface)
@@ -67,12 +78,6 @@ int priority_controller_callback(interface_t * interface, int fd, void * unused)
char buf[100];
int rc;
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = inet_addr("127.0.0.1");
- addr.sin_port = htons(9533);
-
INFO("Priority controller receiving command");
rc = recv(data->fd, buf, 100, 0);
@@ -119,8 +124,6 @@ int priority_controller_callback(interface_t * interface, int fd, void * unused)
interface_raise_event(interface, facelet_w);
interface_raise_event(interface, facelet_c);
- facelet_free(facelet_w);
- facelet_free(facelet_c);
return 0;
}
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index 8540addcf..e7caf4f1c 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -2283,7 +2283,7 @@ hc_face_get(hc_sock_t * s, hc_face_t * face, hc_face_t ** face_found)
*face_found = NULL;
return 0;
}
- *face_found = malloc(sizeof(face_t));
+ *face_found = malloc(sizeof(hc_face_t));
hc_connection_to_face(connection_found, *face_found);
free(connection_found);
break;
@@ -2299,7 +2299,7 @@ hc_face_get(hc_sock_t * s, hc_face_t * face, hc_face_t ** face_found)
*face_found = NULL;
return 0;
}
- *face_found = malloc(sizeof(face_t));
+ *face_found = malloc(sizeof(hc_face_t));
hc_listener_to_face(listener_found, *face_found);
free(listener_found);
break;