summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Guiraud <christophe.guiraud@intel.com>2013-08-22 15:10:55 +0200
committerrmerlino <regis.merlino@intel.com>2013-12-12 14:52:48 +0100
commit44cc09c4060c4517f66a8c858fc736de8dad9a89 (patch)
tree01001655d27d4b29e3b67480d77a3355eed89c77
parent3fe763db75fc8cbcd2f1f95e0897bc374ef817db (diff)
downloaddleyna-server-44cc09c4060c4517f66a8c858fc736de8dad9a89.tar.gz
[Device] Move the network interface info storage
The network interface info which is used for the device wake-on is now stored in the dls_device_t structure instead of the dls_device_context_t structure. This makes more sense since we only store the one network interface info element (the best matching) whatever the device context count of a device. Signed-off-by: Christophe Guiraud <christophe.guiraud@intel.com>
-rw-r--r--libdleyna/server/device.c14
-rw-r--r--libdleyna/server/device.h2
2 files changed, 7 insertions, 9 deletions
diff --git a/libdleyna/server/device.c b/libdleyna/server/device.c
index e20b9f3..6a3bc2c 100644
--- a/libdleyna/server/device.c
+++ b/libdleyna/server/device.c
@@ -244,8 +244,6 @@ void dls_device_delete_context(dls_device_context_t *ctx)
if (ctx->device_proxy)
g_object_unref(ctx->device_proxy);
- prv_free_network_if_info(ctx->network_if_info);
-
if (ctx->cds.proxy)
g_object_unref(ctx->cds.proxy);
@@ -308,8 +306,6 @@ static void prv_context_new(const gchar *ip_address,
ctx->ems.subscribed = FALSE;
ctx->ems.timeout_id = 0;
- ctx->network_if_info = NULL;
-
g_object_ref(proxy);
g_object_ref(device_info);
@@ -349,6 +345,8 @@ void dls_device_delete(void *device)
(void) dls_server_get_connector()->unpublish_subtree(
dev->connection, dev->id);
+ prv_free_network_if_info(dev->network_if_info);
+
g_ptr_array_unref(dev->contexts);
dls_device_delete_context(dev->sleeping_context);
g_free(dev->path);
@@ -799,9 +797,9 @@ static gboolean prv_get_device_sleeping_state(dls_device_t *device,
else
*sleeping = TRUE;
- prv_free_network_if_info(ctx->network_if_info);
+ prv_free_network_if_info(device->network_if_info);
- ctx->network_if_info = info;
+ device->network_if_info = info;
info_list = g_list_remove(info_list, info);
@@ -5970,14 +5968,14 @@ void dls_device_wake(dls_client_t *client, dls_task_t *task)
context = dls_device_get_context(device, client);
if ((context->ems.proxy == NULL) ||
- (context->network_if_info == NULL)) {
+ (device->network_if_info == NULL)) {
cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
DLEYNA_ERROR_NOT_SUPPORTED,
"Wake is not supported");
goto on_complete;
}
- info = context->network_if_info;
+ info = device->network_if_info;
DLEYNA_LOG_DEBUG("MacAddress = %s", info->mac_address);
DLEYNA_LOG_DEBUG("DeviceUUID = %s", info->device_uuid);
diff --git a/libdleyna/server/device.h b/libdleyna/server/device.h
index 938e622..8b4888a 100644
--- a/libdleyna/server/device.h
+++ b/libdleyna/server/device.h
@@ -58,7 +58,6 @@ struct dls_device_context_t_ {
dls_device_t *device;
dls_service_t cds;
dls_service_t ems;
- dls_network_if_info_t *network_if_info;
};
typedef struct dls_device_icon_t_ dls_device_icon_t;
@@ -88,6 +87,7 @@ struct dls_device_t_ {
guint construct_step;
dls_device_icon_t icon;
gboolean sleeping;
+ dls_network_if_info_t *network_if_info;
};
dls_device_context_t *dls_device_append_new_context(dls_device_t *device,