Support the remote client service
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 5 Aug 2013 12:52:20 +0000 (21:52 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 5 Aug 2013 12:52:20 +0000 (21:52 +0900)
Change-Id: I7367e1496ef0117d167f8b48d8e3295e1ad087d4

include/conf.h
packaging/liblivebox-viewer.spec
src/client.c

index 4f50bfe..57a8b92 100644 (file)
@@ -26,4 +26,8 @@
 #define VCONFKEY_MASTER_STARTED        "memory/data-provider-master/started"
 #endif
 
+#if !defined(VCONFKEY_MASTER_CLIENT_ADDR)
+#define VCONFKEY_MASTER_CLIENT_ADDR "db/data-provider-master/serveraddr"
+#endif
+
 /* End of a file */
index dd36919..d34f4bf 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-viewer
 Summary: Library for developing the application.
-Version: 0.13.9
+Version: 0.14.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 92a4c1b..bb6568e 100644 (file)
 static struct info {
        int fd;
        guint timer_id;
+       char *client_addr;
 } s_info = {
        .fd = -1,
        .timer_id = 0,
+       .client_addr = NULL,
 };
 
 static struct packet *master_fault_package(pid_t pid, int handle, const struct packet *packet)
@@ -1256,7 +1258,7 @@ static inline int make_connection(void)
 
        DbgPrint("Let's making connection!\n");
 
-       s_info.fd = com_core_packet_client_init(CLIENT_SOCKET, 0, s_table);
+       s_info.fd = com_core_packet_client_init(client_addr(), 0, s_table);
        if (s_info.fd < 0) {
                ErrPrint("Try this again later\n");
                return LB_STATUS_ERROR_IO;
@@ -1345,6 +1347,17 @@ static int disconnected_cb(int handle, void *data)
 
 int client_init(void)
 {
+       s_info.client_addr = vconf_get_str(VCONFKEY_MASTER_CLIENT_ADDR);
+       if (!s_info.client_addr) {
+               s_info.client_addr = strdup(CLIENT_SOCKET);
+               if (!s_info.client_addr) {
+                       ErrPrint("Heap: %s\n", strerror(errno));
+                       return -ENOMEM;
+               }
+       }
+
+       DbgPrint("Server Address: %s\n", s_info.client_addr);
+
        com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
        com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
        if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0)
@@ -1363,7 +1376,7 @@ int client_fd(void)
 
 const char *client_addr(void)
 {
-       return CLIENT_SOCKET;
+       return s_info.client_addr;
 }
 
 int client_fini(void)