httpclient: Make the GCancellable handling thread-safe
A GCancellable can be cancelled from a different thread than the one where the GTask for the goa_http_client_check operation was created. Since the GCancellable::cancelled handler is invoked in the same thread as the g_cancellable_cancel call, unguarded access to the GError in CheckData is unsafe. Instead of introducing a GMutex, the GError can be set in the response callback which is guaranteed to be invoked in the same thread where the GTask was created. Ensuring that the GError is always accessed from the same thread makes it considerably easier to reason about its state. eg., it can be guaranteed that it won't be set if the status of the response isn't SOUP_STATUS_CANCELLED.
Showing with 16 additions and 16 deletions