diff options
author | Timm Bäder <mail@baedert.org> | 2016-07-21 14:40:35 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-02-21 16:59:25 +0100 |
commit | 5baf8b6f131abb8688dacb25c37ec8ea39780320 (patch) | |
tree | e712f19e5aa2912615784d34bac42cf130595f32 | |
parent | d81a14b4a499b322f45a34798df2c742b5d71a52 (diff) | |
download | librest-5baf8b6f131abb8688dacb25c37ec8ea39780320.tar.gz |
RestProxyCall: Make _cancel() private
-rw-r--r-- | rest/rest-proxy-call.c | 62 | ||||
-rw-r--r-- | rest/rest-proxy-call.h | 2 |
2 files changed, 24 insertions, 40 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c index f45d3af..2861a56 100644 --- a/rest/rest-proxy-call.c +++ b/rest/rest-proxy-call.c @@ -584,6 +584,28 @@ _handle_error_from_message (SoupMessage *message, GError **error) return FALSE; } +static void +_rest_proxy_call_cancel (RestProxyCall *call) +{ + RestProxyCallPrivate *priv = GET_PRIVATE (call); + RestProxyCallAsyncClosure *closure; + + closure = priv->cur_call_closure; + + if (priv->cancellable) + { + g_signal_handler_disconnect (priv->cancellable, priv->cancel_sig); + g_clear_object (&priv->cancellable); + } + + if (closure) + { + /* This will cause the _call_message_completed_cb to be fired which will + * tidy up the closure and so forth */ + _rest_proxy_cancel_message (priv->proxy, closure->message); + } +} + static gboolean finish_call (RestProxyCall *call, SoupMessage *message, GError **error) { @@ -660,7 +682,7 @@ _call_async_weak_notify_cb (gpointer *data, closure = (RestProxyCallAsyncClosure *)data; /* Will end up freeing the closure */ - rest_proxy_call_cancel (closure->call); + _rest_proxy_call_cancel (closure->call); } static void @@ -864,7 +886,7 @@ static void _call_message_call_cancelled_cb (GCancellable *cancellable, RestProxyCall *call) { - rest_proxy_call_cancel (call); + _rest_proxy_call_cancel (call); } static void @@ -1177,42 +1199,6 @@ rest_proxy_call_upload (RestProxyCall *call, } /** - * rest_proxy_call_cancel: (skip) - * @call: The #RestProxyCall - * - * Cancel this call. It may be too late to not actually send the message, but - * the callback will not be invoked. - * - * N.B. this method should only be used with rest_proxy_call_async() and NOT - * rest_proxy_call_invoke_async(). - */ -gboolean -rest_proxy_call_cancel (RestProxyCall *call) -{ - RestProxyCallPrivate *priv = GET_PRIVATE (call); - RestProxyCallAsyncClosure *closure; - - g_return_val_if_fail (REST_IS_PROXY_CALL (call), FALSE); - - closure = priv->cur_call_closure; - - if (priv->cancellable) - { - g_signal_handler_disconnect (priv->cancellable, priv->cancel_sig); - g_clear_object (&priv->cancellable); - } - - if (closure) - { - /* This will cause the _call_message_completed_cb to be fired which will - * tidy up the closure and so forth */ - _rest_proxy_cancel_message (priv->proxy, closure->message); - } - - return TRUE; -} - -/** * rest_proxy_call_sync: * @call: a #RestProxycall * @error_out: a #GError or %NULL diff --git a/rest/rest-proxy-call.h b/rest/rest-proxy-call.h index 0c37e7c..f8ff714 100644 --- a/rest/rest-proxy-call.h +++ b/rest/rest-proxy-call.h @@ -188,8 +188,6 @@ gboolean rest_proxy_call_upload (RestProxyCall *call, gpointer userdata, GError **error); -gboolean rest_proxy_call_cancel (RestProxyCall *call); - gboolean rest_proxy_call_sync (RestProxyCall *call, GError **error_out); /* Functions for dealing with responses */ |