summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/conf.h4
-rw-r--r--packaging/liblivebox-viewer.spec2
-rw-r--r--src/client.c17
3 files changed, 20 insertions, 3 deletions
diff --git a/include/conf.h b/include/conf.h
index 4f50bfe..57a8b92 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -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 */
diff --git a/packaging/liblivebox-viewer.spec b/packaging/liblivebox-viewer.spec
index dd36919..d34f4bf 100644
--- a/packaging/liblivebox-viewer.spec
+++ b/packaging/liblivebox-viewer.spec
@@ -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
diff --git a/src/client.c b/src/client.c
index 92a4c1b..bb6568e 100644
--- a/src/client.c
+++ b/src/client.c
@@ -45,9 +45,11 @@
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)