From 9c82a961443f440ac567e6b8672f06a56969ed60 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 2 Sep 2014 15:52:54 +0900 Subject: [PATCH] Apply direct update path mode [model] Redwood,Kiran,B3(Wearable) [binary_type] AP [customer] Docomo/Orange/ATT/Open [issue#] N/A [problem] [cause] [solution] [team] HomeTF [request] [horizontal_expansion] Change-Id: I4ca7362aac410ec50d989937c9c43ff635e173b4 --- CMakeLists.txt | 1 + include/client_life.h | 4 +++- src/client_life.c | 29 ++++++++++++++++++++++++++--- src/instance.c | 10 ++++++---- src/server.c | 5 +++-- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2cd074..004e6ee 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ ADD_DEFINITIONS("-DSHORTCUT_SMACK_LABEL=\"data-provider-master::shortcut\"") ADD_DEFINITIONS("-DNOTIFICATION_SMACK_LABEL=\"data-provider-master::notification\"") ADD_DEFINITIONS("-DBADGE_SMACK_LABEL=\"data-provider-master::badge\"") ADD_DEFINITIONS("-DDATA_SHARE_LABEL=\"data-provider-master::share\"") +ADD_DEFINITIONS("-DDEFAULT_SMACK_LABEL=\"data-provider-master\"") ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"") diff --git a/include/client_life.h b/include/client_life.h index fa88612..b844659 100644 --- a/include/client_life.h +++ b/include/client_life.h @@ -31,7 +31,7 @@ struct packet; * \note * Create & Destroy */ -extern struct client_node *client_create(pid_t pid, int handle); +extern struct client_node *client_create(pid_t pid, int handle, const char *direct_addr); #define client_destroy(client) client_unref(client) /*! @@ -102,4 +102,6 @@ extern int client_browse_list(const char *cluster, const char *category, int (*c extern int client_nr_of_subscriber(const char *cluster, const char *category); extern int client_broadcast(struct inst_info *inst, struct packet *packet); + +extern const char *client_direct_addr(const struct client_node *client); /* End of a file */ diff --git a/src/client_life.c b/src/client_life.c index d01dc2a..e6d1ed6 100644 --- a/src/client_life.c +++ b/src/client_life.c @@ -16,6 +16,11 @@ #include #include +#include +#include +#include +#include +#include #include #include @@ -96,6 +101,7 @@ struct client_node { Eina_List *subscribe_list; int faulted; + char *direct_addr; }; static inline void invoke_global_destroyed_cb(struct client_node *client) @@ -234,6 +240,11 @@ static inline void destroy_client_data(struct client_node *client) s_info.nr_of_paused_clients--; } + if (client->direct_addr) { + (void)unlink(client->direct_addr); + DbgFree(client->direct_addr); + } + s_info.client_list = eina_list_remove(s_info.client_list, client); DbgFree(client); @@ -245,7 +256,7 @@ static inline void destroy_client_data(struct client_node *client) xmonitor_handle_state_changes(); } -static inline struct client_node *create_client_data(pid_t pid) +static inline struct client_node *create_client_data(pid_t pid, const char *direct_addr) { struct client_node *client; @@ -258,6 +269,13 @@ static inline struct client_node *create_client_data(pid_t pid) client->pid = pid; client->refcnt = 1; + if (direct_addr && direct_addr[0]) { + client->direct_addr = strdup(direct_addr); + if (!client->direct_addr) { + ErrPrint("Failed to allocate direct_addr (%s)\n", direct_addr); + } + } + s_info.client_list = eina_list_append(s_info.client_list, client); /*! @@ -293,7 +311,7 @@ static Eina_Bool created_cb(void *data) * So we just create its ADT in this function. * And invoke the global created event & activated event callbacks */ -HAPI struct client_node *client_create(pid_t pid, int handle) +HAPI struct client_node *client_create(pid_t pid, int handle, const char *direct_addr) { struct client_node *client; int ret; @@ -304,7 +322,7 @@ HAPI struct client_node *client_create(pid_t pid, int handle) return client; } - client = create_client_data(pid); + client = create_client_data(pid, direct_addr); if (!client) { ErrPrint("Failed to create a new client (%d)\n", pid); return NULL; @@ -867,4 +885,9 @@ HAPI int client_broadcast(struct inst_info *inst, struct packet *packet) return LB_STATUS_SUCCESS; } +HAPI const char *client_direct_addr(const struct client_node *client) +{ + return client ? client->direct_addr : NULL; +} + /* End of a file */ diff --git a/src/instance.c b/src/instance.c index 6340d1e..1689bf2 100644 --- a/src/instance.c +++ b/src/instance.c @@ -1561,7 +1561,7 @@ HAPI int instance_reactivate(struct inst_info *inst) break; } - packet = packet_create((const char *)&cmd, "sssiidssiisii", + packet = packet_create((const char *)&cmd, "sssiidssiisiis", package_name(inst->info), inst->id, inst->content, @@ -1573,7 +1573,8 @@ HAPI int instance_reactivate(struct inst_info *inst) inst->lb.width, inst->lb.height, package_abi(inst->info), inst->scroll_locked, - inst->active_update); + inst->active_update, + client_direct_addr(inst->client)); if (!packet) { ErrPrint("Failed to build a packet for %s\n", package_name(inst->info)); return LB_STATUS_ERROR_FAULT; @@ -1628,7 +1629,7 @@ HAPI int instance_activate(struct inst_info *inst) break; } - packet = packet_create((const char *)&cmd, "sssiidssisii", + packet = packet_create((const char *)&cmd, "sssiidssisiis", package_name(inst->info), inst->id, inst->content, @@ -1640,7 +1641,8 @@ HAPI int instance_activate(struct inst_info *inst) !!inst->client, package_abi(inst->info), inst->lb.width, - inst->lb.height); + inst->lb.height, + client_direct_addr(inst->client)); if (!packet) { ErrPrint("Failed to build a packet for %s\n", package_name(inst->info)); return LB_STATUS_ERROR_FAULT; diff --git a/src/server.c b/src/server.c index f435393..bc66eff 100644 --- a/src/server.c +++ b/src/server.c @@ -777,6 +777,7 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet { struct client_node *client; struct packet *result; + const char *direct_addr; double timestamp; int ret; @@ -787,7 +788,7 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet goto out; } - if (packet_get(packet, "d", ×tamp) != 1) { + if (packet_get(packet, "ds", ×tamp, &direct_addr) != 2) { ErrPrint("Invalid arguemnt\n"); ret = LB_STATUS_ERROR_INVALID; goto out; @@ -798,7 +799,7 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet * \note * client_create will invoke the client created callback */ - client = client_create(pid, handle); + client = client_create(pid, handle, direct_addr); if (!client) { ErrPrint("Failed to create a new client for %d\n", pid); ret = LB_STATUS_ERROR_FAULT; -- 2.7.4