SEL Verification - bug fixed
authorSung-jae Park <nicesj.park@samsung.com>
Sat, 28 Jul 2012 15:47:43 +0000 (00:47 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Sat, 28 Jul 2012 23:33:30 +0000 (08:33 +0900)
S1-6489
S1-6520
S1-6337
S1-6494
S1-5750
P120725-0076

Change-Id: I32d7b8f3b0f050fe48478cb3d4e5266e4d1410cc

CMakeLists.txt
data/data-provider-master
debian/changelog
include/client_life.h
packaging/com.samsung.data-provider-master.spec
src/client_life.c
src/client_rpc.c
src/dead_monitor.c
src/server.c
src/slave_rpc.c

index 779cb5d..7c8a9c6 100644 (file)
@@ -35,6 +35,7 @@ ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
 
 ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"")
 ADD_DEFINITIONS("-DSLAVE_WEB_PKGNAME=\"com.samsung.data-provider-webslave\"")
+ADD_DEFINITIONS("-DSOCKET_FILE=\"/opt/share/live_magazine/.live.socket\"")
 
 ADD_DEFINITIONS("-DNDEBUG")
 #ADD_DEFINITIONS("-DFLOG")
index 56dc036..6460915 100755 (executable)
@@ -16,6 +16,8 @@ launch_provider()
 
 start ()
 {
+       rm /opt/share/live_magazine/*
+       rm /tmp/.stop.provider
        launch_provider &
 }
 
index 66ef7bb..c791404 100644 (file)
@@ -1,3 +1,10 @@
+data-provider-master (0.6.0) unstable; urgency=low
+
+  * Git: slp/pkgs/d/data-provider-master
+  * Tag: data-provider-master_0.6.0
+
+ -- Sung-jae Park <nicesj.park@samsung.com>  Sun, 29 Jul 2012 08:33:05 +0900
+
 data-provider-master (0.5.9) unstable; urgency=low
 
   * Git: slp/pkgs/d/data-provider-master
index 26aa8df..5736ee6 100644 (file)
@@ -43,7 +43,7 @@ extern int client_count(void);
  * \note
  * For dead signal handler
  */
-extern int client_fault(struct client_node *client);
+extern int client_deactivated_by_fault(struct client_node *client);
 extern void client_reset_fault(struct client_node *client);
 extern const int const client_is_faulted(const struct client_node *client);
 
index ecc39e6..032db54 100644 (file)
@@ -1,6 +1,6 @@
 Name: com.samsung.data-provider-master
 Summary: Master data provider
-Version: 0.5.9
+Version: 0.6.0
 Release: 1
 Group: main/app
 License: Samsung Proprietary License
index d1a9aad..e14eeaf 100644 (file)
@@ -114,6 +114,7 @@ static inline void destroy_client_data(struct client_node *client)
        }
 
        EINA_LIST_FREE(client->data_list, data) {
+               DbgPrint("Tag is not cleared (%s)\n", data->tag);
                free(data->tag);
                free(data);
        }
@@ -252,6 +253,7 @@ static inline void invoke_deactivated_cb(struct client_node *client)
        Eina_List *n;
        int ret;
 
+       client_ref(client); /*!< Prevent deleting from callback */
        EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
                ret = item->cb(client, item->data);
                if (ret < 0) {
@@ -261,14 +263,15 @@ static inline void invoke_deactivated_cb(struct client_node *client)
                        }
                }
        }
+       client_unref(client);
 }
 
-int client_fault(struct client_node *client)
+int client_deactivated_by_fault(struct client_node *client)
 {
        if (!client || client->faulted)
                return 0;
 
-       DbgPrint("Client is faulted(%d), pid(%d)\n", client->refcnt, client->pid);
+       DbgPrint("Client[%p] is faulted(%d), pid(%d)\n", client, client->refcnt, client->pid);
        client->faulted = 1;
 
        DbgPrint("Reset PID (%d)\n", client->pid);
index 3339d15..a84effa 100644 (file)
@@ -75,13 +75,7 @@ static int recv_cb(pid_t pid, int handle, const struct packet *packet, void *dat
 {
        struct command *command = data;
 
-       if (!packet) {
-               if (command->client) {
-                       DbgPrint("Client fault[%d], discards all response waitings?\n", client_pid(command->client));
-                       client_fault(command->client);
-                       //command->client = NULL;
-               }
-       } else {
+       if (packet) {
                int ret;
 
                packet_get(packet, "i", &ret);
@@ -122,13 +116,13 @@ static Eina_Bool command_consumer_cb(void *data)
        }
 
        if (!client_is_activated(command->client)) {
-               ErrPrint("Client is not activated, destroy this command\n");
+               ErrPrint("Client[%p] is not activated, destroy this command\n", command->client);
                destroy_command(command);
                return ECORE_CALLBACK_RENEW;
        }
 
        if (client_is_faulted(command->client)) {
-               ErrPrint("Client is faulted, discard command\n");
+               ErrPrint("Client[%p] is faulted, discard command\n", command->client);
                destroy_command(command);
                return ECORE_CALLBACK_RENEW;
        }
@@ -146,8 +140,15 @@ static Eina_Bool command_consumer_cb(void *data)
        }
 
        DbgPrint("Send a packet to client [%s]\n", packet_command(command->packet));
-       if (com_core_packet_async_send(rpc->handle, command->packet, 0u, recv_cb, command) < 0)
+       if (com_core_packet_async_send(rpc->handle, command->packet, 0.0f, recv_cb, command) < 0) {
+               /*!
+                * \todo
+                * Do we need to handle this error?
+                * Close current connection and make new one?
+                * how about pended command lists?
+                */
                destroy_command(command);
+       }
 
        return ECORE_CALLBACK_RENEW;
 }
@@ -176,15 +177,14 @@ int client_rpc_async_request(struct client_node *client, struct packet *packet)
                return -EINVAL;
 
        if (client_is_faulted(client)) {
-               ErrPrint("Client is faulted\n");
+               ErrPrint("Client[%p] is faulted\n", client);
                packet_unref(packet);
                return -EFAULT;
        }
 
        rpc = client_data(client, "rpc");
        if (!rpc)
-               ErrPrint("Client is not ready for communication (%s)\n",
-                                                       packet_command(packet));
+               ErrPrint("Client[%p] is not ready for communication (%s)\n", client, packet_command(packet));
 
        command = create_command(client, packet);
        if (!command) {
@@ -249,10 +249,14 @@ static int deactivated_cb(struct client_node *client, void *data)
        DbgPrint("Reset handle for %d\n", client_pid(client));
        rpc->handle = -1;
 
+       DbgPrint("Begin: Destroying command\n");
        EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) {
-               if (command->client == client)
+               if (command->client == client) {
+                       s_info.command_list = eina_list_remove(s_info.command_list, command);
                        destroy_command(command);
+               }
        }
+       DbgPrint("End: Destroying command\n");
 
        return 0;
 }
@@ -271,7 +275,8 @@ static int del_cb(struct client_node *client, void *data)
        free(rpc);
 
        client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, deactivated_cb, NULL);
-       return -1; /* Return <0, Delete this callback */
+       client_event_callback_del(client, CLIENT_EVENT_DESTROY, del_cb, NULL);
+       return 0; /* Return <0, Delete this callback */
 }
 
 int client_rpc_initialize(struct client_node *client, int handle)
index 85c033f..3a99844 100644 (file)
 #include "util.h"
 #include "debug.h"
 
-#if 0
-int aul_listen_app_dead_signal(int (*)(int, void *), void *);
-
-static int dead_cb(int pid, void *cb_data)
-{
-       struct slave_node *slave;
-
-       slave = slave_find_by_pid(pid);
-       if (slave) {
-               slave_deactivated_by_fault(slave);
-       } else {
-               struct client_node *client;
-               client = client_find_by_pid(pid);
-               if (client) {
-                       DbgPrint("Client %d is deactivated\n", client_pid(client));
-                       client_deactivated_by_fault(client);
-               } else {
-                       ErrPrint("Unknown PID:%d is terminated\n", pid);
-                       /*!
-                        * \note
-                        * Ignore this dead signal
-                        */
-               }
-       }
-
-       return 0;
-}
-#endif
 static int evt_cb(int handle, void *data)
 {
        struct slave_node *slave;
@@ -60,10 +32,11 @@ static int evt_cb(int handle, void *data)
        if (client) {
                DbgPrint("Client is disconnected\n");
                if (client_pid(client) != (pid_t)-1)
-                       client_fault(client);
+                       client_deactivated_by_fault(client);
                return 0;
        }
 
+       DbgPrint("This is not my favor: %d\n", handle);
        return 0;
 }
 
index b4602da..95fdd6c 100644 (file)
@@ -2532,7 +2532,6 @@ out:
 }
 
 
-
 static struct method s_table[] = {
        /*!
         * \note
@@ -2701,16 +2700,16 @@ static struct method s_table[] = {
 
 int server_init(void)
 {
-       if (unlink("/tmp/.live.socket") < 0)
+       if (unlink(SOCKET_FILE) < 0)
                ErrPrint("unlink: %s\n", strerror(errno));
 
-       s_info.fd = com_core_packet_server_init("/tmp/.live.socket", s_table);
+       s_info.fd = com_core_packet_server_init(SOCKET_FILE, s_table);
        if (s_info.fd < 0) {
                ErrPrint("Failed to create a server socket\n");
                return s_info.fd;
        }
 
-       chmod("/tmp/.live.socket", 0666);
+       chmod(SOCKET_FILE, 0666);
        return 0;
 }
 
index 0eadd52..edf6cd4 100644 (file)
@@ -188,7 +188,7 @@ static Eina_Bool command_consumer_cb(void *data)
                return ECORE_CALLBACK_RENEW;
        }
 
-       if (com_core_packet_async_send(rpc->handle, command->packet, 0u, slave_async_cb, command) == 0)
+       if (com_core_packet_async_send(rpc->handle, command->packet, 0.0f, slave_async_cb, command) == 0)
                return ECORE_CALLBACK_RENEW;
 
        /*!
@@ -197,6 +197,12 @@ static Eina_Bool command_consumer_cb(void *data)
         * We are failed to send a packet!!!
         * Let's try to send this again
         */
+       /*!
+        * \todo
+        * Do we need to handle this error?
+        * Close current connection and make new one?
+        * how about pended command lists?
+        */
        DbgPrint("Send this packet again\n");
        prepend_command(command);
        return ECORE_CALLBACK_RENEW;