VPP-990 remove registered handler if control ping fails 90/8490/2 v18.01-rc0
authorMatej Perina <mperina@cisco.com>
Thu, 21 Sep 2017 15:03:27 +0000 (17:03 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 27 Sep 2017 20:55:50 +0000 (20:55 +0000)
Change-Id: I5ca5763f0dc0a73cc6f014b855426b7ac180f356
Signed-off-by: Matej Perina <mperina@cisco.com>
src/vlibapi/api_common.h
src/vlibapi/api_shared.c
src/vpp-api/java/jvpp-registry/jvpp_registry.c

index 770cf47..8e6ab0f 100644 (file)
@@ -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);
index 0c4952b..27898c3 100644 (file)
@@ -716,6 +716,18 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
   vl_msg_api_config (c);
 }
 
+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)
 {
index e8264cb..c90822d 100644 (file)
@@ -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;