summaryrefslogtreecommitdiff
path: root/rest/rest-proxy-call.c
diff options
context:
space:
mode:
authorRoss Burton <ross@linux.intel.com>2009-05-11 17:35:09 +0100
committerRoss Burton <ross@linux.intel.com>2009-05-29 15:33:53 +0100
commit92e1871d3181a73a780f588689733f25e3df5b48 (patch)
tree725d0d78e55a72310712e45001c881e7118db56b /rest/rest-proxy-call.c
parent36a47d90b7094731f688873378829305a1e8654e (diff)
Factor out the message result handling
Diffstat (limited to 'rest/rest-proxy-call.c')
-rw-r--r--rest/rest-proxy-call.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index d025cca..8dbc46f 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -514,17 +514,13 @@ _handle_error_from_message (SoupMessage *message, GError **error)
return FALSE;
}
-static void
-_call_async_finished_cb (SoupMessage *message,
- gpointer userdata)
+static gboolean
+finish_call (RestProxyCall *call, SoupMessage *message, GError **error)
{
- RestProxyCallAsyncClosure *closure;
- RestProxyCall *call;
RestProxyCallPrivate *priv;
- GError *error = NULL;
- closure = (RestProxyCallAsyncClosure *)userdata;
- call = closure->call;
+ g_assert (call);
+ g_assert (message);
priv = GET_PRIVATE (call);
/* Convert the soup headers in to hash */
@@ -540,7 +536,23 @@ _call_async_finished_cb (SoupMessage *message,
priv->status_code = message->status_code;
priv->status_message = g_strdup (message->reason_phrase);
- _handle_error_from_message (message, &error);
+ return _handle_error_from_message (message, error);
+}
+
+static void
+_call_async_finished_cb (SoupMessage *message,
+ gpointer userdata)
+{
+ RestProxyCallAsyncClosure *closure;
+ RestProxyCall *call;
+ RestProxyCallPrivate *priv;
+ GError *error = NULL;
+
+ closure = (RestProxyCallAsyncClosure *)userdata;
+ call = closure->call;
+ priv = GET_PRIVATE (call);
+
+ finish_call (call, message, &error);
closure->callback (closure->call,
error,