aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatej Perina <mperina@cisco.com>2017-09-21 17:03:27 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-09-27 20:55:50 +0000
commit75a17ecddc9dc579a3aecfc5b53cbb60e993965f (patch)
tree6a744ee248063303ce1b60a3f92130a0e0b167de
parenta4980b8f3e53bd0917c75910938fbb077105821f (diff)
VPP-990 remove registered handler if control ping fails
Change-Id: I5ca5763f0dc0a73cc6f014b855426b7ac180f356 Signed-off-by: Matej Perina <mperina@cisco.com>
-rw-r--r--src/vlibapi/api_common.h1
-rw-r--r--src/vlibapi/api_shared.c12
-rw-r--r--src/vpp-api/java/jvpp-registry/jvpp_registry.c1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/vlibapi/api_common.h b/src/vlibapi/api_common.h
index 770cf47d..8e6ab0ff 100644
--- a/src/vlibapi/api_common.h
+++ b/src/vlibapi/api_common.h
@@ -144,6 +144,7 @@ void vl_msg_api_set_handlers (int msg_id, char *msg_name,
void *cleanup,
void *endian,
void *print, int msg_size, int traced);
+void vl_msg_api_clean_handlers (int msg_id);
void vl_msg_api_config (vl_msg_api_msg_config_t *);
void vl_msg_api_set_cleanup_handler (int msg_id, void *fp);
void vl_msg_api_queue_handler (unix_shared_memory_queue_t * q);
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 0c4952b1..27898c3b 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -717,6 +717,18 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
}
void
+vl_msg_api_clean_handlers (int msg_id)
+{
+ vl_msg_api_msg_config_t cfg;
+ vl_msg_api_msg_config_t *c = &cfg;
+
+ memset (c, 0, sizeof (*c));
+
+ c->id = msg_id;
+ vl_msg_api_config (c);
+}
+
+void
vl_msg_api_set_cleanup_handler (int msg_id, void *fp)
{
api_main_t *am = &api_main;
diff --git a/src/vpp-api/java/jvpp-registry/jvpp_registry.c b/src/vpp-api/java/jvpp-registry/jvpp_registry.c
index e8264cbf..c90822d7 100644
--- a/src/vpp-api/java/jvpp-registry/jvpp_registry.c
+++ b/src/vpp-api/java/jvpp-registry/jvpp_registry.c
@@ -239,6 +239,7 @@ static int send_initial_control_ping() {
}
if (rv != 0) {
+ vl_msg_api_clean_handlers(rm->control_ping_reply_msg_id);
clib_warning("first control ping failed: %d", rv);
}
return rv;