[Olsr-dev] [PATCH v1 020/115] jsoninfo: add plugin_init hook

Ferry Huberts (spam-protected)
Wed Dec 2 21:27:53 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/jsoninfo/src/olsrd_jsoninfo.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
index 5206aad..68db7b1 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo.c
+++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
@@ -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;
-- 
2.5.0




More information about the Olsr-dev mailing list