[Chain Task] Fix end_func call on error

end_func is now called in any condition, on error during chain call
or when calling msu_chain_task_cancel()

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] Fix potential crash

Test a pointer before using it.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] Save msu_device_context_t

Save context in chain task atom and use it instead of
getting it from device.
We could have multiple context for a device and we should not
use the default one but the one associated with the task.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] Fix typedef

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] Better Chain Task end func support

Save the device context to use in the end_func
Add a destroy func for the end user parameter

Update API for end func functionality

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] New device

Duplicate 'udn' string

'udn' is a pointer to a variable owned by the GUPnP context.
When we are shutting down, this variable does not exist any more.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Coding Convention] Cleanup

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Coding Convention] Decrease Identation

Rearrange code to remove a level of indentation.
Code is more readable.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Task] Fix asynchronous cancel for Task

When GCancellable is called, context is first deleted then
callback to cleanup the task is called.

GUPnPServiceProxy retrieved in context, was saved in the Task User Data
Callback.

When the context was deleted, the proxy was unreferenced/deleted.
The use of the proxy in the task callback is then prohibited.

We add a weak pointer on the GUPnPServiceProxy so the pointer on
the proxy in the task user data is set to null when the object is deleted.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
[Chain Task] Check context when cancel is called

As for Tasks, Chain Task Cancel callback could be called after
a context has been deleted.

Check if it's still available before using it.

Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>