cloud-setup: fix handling cancellation of internal GET operation for EC2 provider
There are two GCancellable at work: one is provided by the user during nmcs_provider_get_config(), and one is used internally for the individual HTTP GET requests. In _get_config_fetch_done_cb(), if the error reason is "cancelled", then it means that our internal iface_data->cancellable was cancelled. Probably because an error happend (like a timeout or the user cancelled the external GCancellable). In that case, we must not report that the task completed with a cancellation, because we need to preserve the error that was the original cause.
This commit is contained in:
@@ -235,8 +235,16 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If nm_utils_error_is_cancelled(error), then our internal iface_data->cancellable
|
||||||
|
* was cancelled, because the overall request failed. From point of view of the
|
||||||
|
* caller, this does not mean that a cancellation happened. It also means, our
|
||||||
|
* request overall is already about to fail. */
|
||||||
|
nm_assert(!nm_utils_error_is_cancelled(error) || iface_data->error);
|
||||||
|
|
||||||
iface_data->n_pending--;
|
iface_data->n_pending--;
|
||||||
_get_config_task_maybe_return(iface_data, g_steal_pointer(&error));
|
_get_config_task_maybe_return(iface_data,
|
||||||
|
nm_utils_error_is_cancelled(error) ? NULL
|
||||||
|
: g_steal_pointer(&error));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user