void dls_upnp_cancel_upload(dls_upnp_t *upnp, dls_task_t *task) { GError *error = NULL; DLEYNA_LOG_DEBUG("Enter"); DLEYNA_LOG_DEBUG("Root Path %s Id %s", task->target.root_path, task->target.id); if (strcmp(task->target.id, "0")) { DLEYNA_LOG_WARNING("Bad path %s", task->target.path); error = g_error_new(DLEYNA_SERVER_ERROR, DLEYNA_ERROR_BAD_PATH, "CancelUpload must be executed on a root path"); goto on_error; } (void) dls_device_cancel_upload(task, &error); on_error: if (error) { dls_task_fail(task, error); g_error_free(error); } else { dls_task_complete(task); } DLEYNA_LOG_DEBUG("Exit"); }
static void prv_async_task_complete(dls_task_t *task, GError *error) { DLEYNA_LOG_DEBUG("Enter"); if (!error) { dls_task_complete(task); } else { dls_task_fail(task, error); g_error_free(error); } dleyna_task_queue_task_completed(task->atom.queue_id); DLEYNA_LOG_DEBUG("Exit"); }
static void prv_process_sync_task(dls_task_t *task) { dls_client_t *client; const gchar *client_name; switch (task->type) { case DLS_TASK_GET_VERSION: task->result = g_variant_ref_sink(g_variant_new_string( VERSION)); dls_task_complete(task); break; case DLS_TASK_GET_SERVERS: task->result = dls_upnp_get_device_ids(g_context.upnp); dls_task_complete(task); break; case DLS_TASK_RESCAN: dls_upnp_rescan(g_context.upnp); dls_task_complete(task); break; case DLS_TASK_SET_PROTOCOL_INFO: client_name = dleyna_task_queue_get_source(task->atom.queue_id); client = g_hash_table_lookup(g_context.watchers, client_name); if (client) { g_free(client->protocol_info); if (task->ut.protocol_info.protocol_info[0]) { client->protocol_info = task->ut.protocol_info.protocol_info; task->ut.protocol_info.protocol_info = NULL; } else { client->protocol_info = NULL; } } dls_task_complete(task); break; case DLS_TASK_SET_PREFER_LOCAL_ADDRESSES: client_name = dleyna_task_queue_get_source(task->atom.queue_id); client = g_hash_table_lookup(g_context.watchers, client_name); if (client) { client->prefer_local_addresses = task->ut.prefer_local_addresses.prefer; } dls_task_complete(task); break; case DLS_TASK_GET_UPLOAD_STATUS: dls_upnp_get_upload_status(g_context.upnp, task); break; case DLS_TASK_GET_UPLOAD_IDS: dls_upnp_get_upload_ids(g_context.upnp, task); break; case DLS_TASK_CANCEL_UPLOAD: dls_upnp_cancel_upload(g_context.upnp, task); break; default: goto finished; break; } dleyna_task_queue_task_completed(task->atom.queue_id); finished: return; }