jsoninfo: add plugin_init hook
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 1 Dec 2015 06:43:24 +0000 (07:43 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 17:41:13 +0000 (18:41 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_jsoninfo.c

index 5206aad..68db7b1 100644 (file)
@@ -196,6 +196,15 @@ static void determine_action(unsigned int *send_what, char *requ) {
   }
 }
 
+static void plugin_init(void) {
+  /* Get start time */
+  gettimeofday(&start_time, NULL);
+
+  if (!strlen(uuidfile))
+    strscpy(uuidfile, "uuid.txt", sizeof(uuidfile));
+  read_uuid_from_file(PLUGIN_NAME, uuidfile);
+}
+
 /**
  *Do initialization here
  *
@@ -206,12 +215,7 @@ int olsrd_plugin_init(void) {
   /* Initial IPC value */
   ipc_socket = -1;
 
-  /* Get start time */
-  gettimeofday(&start_time, NULL);
-
-  if (!strlen(uuidfile))
-    strscpy(uuidfile, "uuid.txt", sizeof(uuidfile));
-  read_uuid_from_file(PLUGIN_NAME, uuidfile);
+  plugin_init();
 
   plugin_ipc_init();
   return 1;