gboolean dlr_host_service_remove(dlr_host_service_t *host_service, const gchar *device_if, const gchar *client, const gchar *file) { gboolean retval = FALSE; dlr_host_file_t *hf; dlr_host_server_t *server; server = g_hash_table_lookup(host_service->servers, device_if); if (!server) goto on_error; hf = g_hash_table_lookup(server->files, file); if (!hf) goto on_error; retval = prv_remove_client(host_service, client, server, device_if, file, hf); if (!retval) goto on_error; if (hf->clients->len == 0) g_hash_table_remove(server->files, file); if (g_hash_table_size(server->files) == 0) g_hash_table_remove(host_service->servers, device_if); on_error: return retval; }
void dlr_host_service_lost_client(dlr_host_service_t *host_service, const gchar *client) { GHashTableIter iter; GHashTableIter iter2; gpointer value; gpointer key; gpointer value2; gpointer key2; dlr_host_server_t *server; dlr_host_file_t *hf; g_hash_table_iter_init(&iter, host_service->servers); while (g_hash_table_iter_next(&iter, &key, &value)) { server = value; g_hash_table_iter_init(&iter2, server->files); while (g_hash_table_iter_next(&iter2, &key2, &value2)) { hf = value2; if (!prv_remove_client(host_service, client, server, key, key2, hf)) continue; if (hf->clients->len > 0) continue; g_hash_table_iter_remove(&iter2); } if (g_hash_table_size(server->files) == 0) g_hash_table_iter_remove(&iter); } }
static void prv_dlr_method_call(dleyna_connector_id_t conn, const gchar *sender, const gchar *object, const gchar *interface, const gchar *method, GVariant *parameters, dleyna_connector_msg_id_t invocation) { dlr_task_t *task; DLEYNA_LOG_INFO("Calling %s method", method); if (!strcmp(method, DLR_INTERFACE_RELEASE)) { g_context.connector->unwatch_client(sender); prv_remove_client(sender); g_context.connector->return_response(invocation, NULL); } else { if (!strcmp(method, DLR_INTERFACE_GET_VERSION)) task = dlr_task_get_version_new(invocation); else if (!strcmp(method, DLR_INTERFACE_GET_SERVERS)) task = dlr_task_get_servers_new(invocation); else goto finished; prv_add_task(task, sender, DLR_RENDERER_SINK); } finished: return; }
static void prv_manager_root_method_call(dleyna_connector_id_t conn, const gchar *sender, const gchar *object, const gchar *interface, const gchar *method, GVariant *parameters, dleyna_connector_msg_id_t invocation) { dld_task_t *task; DLEYNA_LOG_INFO("Calling %s method", method); if (!strcmp(method, DLD_INTERFACE_RELEASE)) { g_context.connector->unwatch_client(sender); prv_remove_client(sender); g_context.connector->return_response(invocation, NULL); goto finished; } else { if (!strcmp(method, DLD_INTERFACE_GET_VERSION)) task = dld_task_get_version_new(invocation); else if (!strcmp(method, DLD_INTERFACE_GET_DEVICES)) task = dld_task_get_devices_new(invocation); else if (!strcmp(method, DLD_INTERFACE_RESCAN)) task = dld_task_rescan_new(invocation); else goto finished; } prv_add_task(task, sender, DLD_DIAGNOSTICS_SINK); finished: return; }
static void prv_manager_root_method_call( dleyna_connector_id_t conn, const gchar *sender, const gchar *object, const gchar *interface, const gchar *method, GVariant *parameters, dleyna_connector_msg_id_t invocation) { dls_task_t *task; if (!strcmp(method, DLS_INTERFACE_RELEASE)) { prv_remove_client(sender); g_context.connector->return_response(invocation, NULL); goto finished; } else if (!strcmp(method, DLS_INTERFACE_RESCAN)) { task = dls_task_rescan_new(invocation); } else if (!strcmp(method, DLS_INTERFACE_GET_VERSION)) { task = dls_task_get_version_new(invocation); } else if (!strcmp(method, DLS_INTERFACE_GET_SERVERS)) { task = dls_task_get_servers_new(invocation); } else if (!strcmp(method, DLS_INTERFACE_SET_PROTOCOL_INFO)) { task = dls_task_set_protocol_info_new(invocation, parameters); } else if (!strcmp(method, DLS_INTERFACE_PREFER_LOCAL_ADDRESSES)) { task = dls_task_prefer_local_addresses_new(invocation, parameters); } else { goto finished; } prv_add_task(task, sender, DLS_SERVER_SINK); finished: return; }
static void prv_lost_client(const gchar *name) { DLEYNA_LOG_INFO("Client %s lost", name); prv_remove_client(name); }
static void prv_lost_client(const gchar *name) { DLEYNA_LOG_DEBUG("Lost Client %s", name); prv_remove_client(name); }