Load plugin for sdbd service 78/266278/1 submit/tizen_6.5/20211110.074508
authormanish.r <manish.r@samsung.com>
Fri, 15 Oct 2021 08:22:21 +0000 (13:52 +0530)
committermanish.r <manish.r@samsung.com>
Wed, 10 Nov 2021 07:39:36 +0000 (13:09 +0530)
Change-Id: Ic809b6fdd5894048a03b77774a8de9a4ab21b682
Signed-off-by: manish.r <manish.r@samsung.com>
src/plugin.c [changed mode: 0644->0755]
src/sdb.c

old mode 100644 (file)
new mode 100755 (executable)
index bf41732..2efe7d2
@@ -200,6 +200,19 @@ void unload_sdbd_plugin()
     }
 }
 
+void unload_sdbd_service_plugin()
+{
+    if ( plugin_cmd_hashtable ) {
+        hashtable_destroy ( plugin_cmd_hashtable );
+        plugin_cmd_hashtable = NULL;
+    }
+
+    if ( g_plugin_handle ) {
+        dlclose ( g_plugin_handle );
+        g_plugin_handle = NULL;
+    }
+}
+
 // return 1 if plugin support given command
 // return 0 if plugin does not support given command
 int is_supported_by_plugin ( int cmd )
@@ -223,7 +236,6 @@ int request_sync_cmd ( int cmd, parameters* in, parameters* out )
 
     out->number_of_parameter = 0;
     out->array_of_parameter = NULL;
-
     if ( plugin_cmd_hashtable ) {
        ret = hashtable_get ( plugin_cmd_hashtable, cmd, &pr );
        if ( ret == 1 ) {
@@ -238,12 +250,14 @@ int request_sync_cmd ( int cmd, parameters* in, parameters* out )
                ret = default_plugin_sync_proc ( cmd, in, out );
        }
     } else {
+        E("Plugin Command HashTable Does Not Exist");
        ret = default_plugin_sync_proc ( cmd, in, out );
     }
 
     return ret;
 }
 
+
 static void request_async_cmd ( int cmd, parameters* in, int out_fd )
 {
     int ret, pr;
index 6db537c..06ad083 100755 (executable)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -1220,6 +1220,12 @@ static void sdb_cleanup(void)
     unload_sdbd_plugin();
 }
 
+static void sdb_service_cleanup(void)
+{
+    unload_sdbd_service_plugin();
+}
+
+
 void start_device_log(void)
 {
     int fd;
@@ -2190,8 +2196,10 @@ int sdb_main(int server_port)
 
 void sdb_main_service()
 {
+    load_sdbd_plugin();
     init_capabilities();
     init_sdk_requirements();
+    atexit(sdb_service_cleanup);
 }
 
 int copy_packet(apacket* dest, apacket* src) {