[libsoup] message-io: rename run_unril_finish as skip
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] message-io: rename run_unril_finish as skip
- Date: Thu, 20 May 2021 13:26:44 +0000 (UTC)
commit e8b6f3a063970a46fb237c77fabb9beafa4e9ed0
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu May 20 15:10:22 2021 +0200
message-io: rename run_unril_finish as skip
This is only used by the client stream when it's closed. We are never
interested in the data read, we just want to skip it.
libsoup/http1/soup-client-message-io-http1.c | 12 +++++-----
libsoup/http2/soup-client-message-io-http2.c | 12 +++++-----
libsoup/soup-client-input-stream.c | 34 +++++-----------------------
libsoup/soup-client-message-io.c | 12 +++++-----
libsoup/soup-client-message-io.h | 4 ++--
libsoup/soup-message-private.h | 2 +-
libsoup/soup-message.c | 10 ++++----
7 files changed, 32 insertions(+), 54 deletions(-)
---
diff --git a/libsoup/http1/soup-client-message-io-http1.c b/libsoup/http1/soup-client-message-io-http1.c
index cb181e30..6a74318b 100644
--- a/libsoup/http1/soup-client-message-io-http1.c
+++ b/libsoup/http1/soup-client-message-io-http1.c
@@ -951,11 +951,11 @@ soup_client_message_io_http1_run_until_read_async (SoupClientMessageIO *iface,
}
static gboolean
-soup_client_message_io_http1_run_until_finish (SoupClientMessageIO *iface,
- SoupMessage *msg,
- gboolean blocking,
- GCancellable *cancellable,
- GError **error)
+soup_client_message_io_http1_skip (SoupClientMessageIO *iface,
+ SoupMessage *msg,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error)
{
SoupClientMessageIOHTTP1 *io = (SoupClientMessageIOHTTP1 *)iface;
gboolean success;
@@ -1130,7 +1130,7 @@ static const SoupClientMessageIOFuncs io_funcs = {
soup_client_message_io_http1_run,
soup_client_message_io_http1_run_until_read,
soup_client_message_io_http1_run_until_read_async,
- soup_client_message_io_http1_run_until_finish,
+ soup_client_message_io_http1_skip,
soup_client_message_io_http1_is_open,
soup_client_message_io_http1_in_progress,
soup_client_message_io_http1_is_reusable,
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 1fec42ab..bea7136a 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -1213,11 +1213,11 @@ soup_client_message_io_http2_run_until_read (SoupClientMessageIO *iface,
}
static gboolean
-soup_client_message_io_http2_run_until_finish (SoupClientMessageIO *iface,
- SoupMessage *msg,
- gboolean blocking,
- GCancellable *cancellable,
- GError **error)
+soup_client_message_io_http2_skip (SoupClientMessageIO *iface,
+ SoupMessage *msg,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error)
{
SoupClientMessageIOHTTP2 *io = (SoupClientMessageIOHTTP2 *)iface;
@@ -1336,7 +1336,7 @@ static const SoupClientMessageIOFuncs io_funcs = {
soup_client_message_io_http2_run,
soup_client_message_io_http2_run_until_read,
soup_client_message_io_http2_run_until_read_async,
- soup_client_message_io_http2_run_until_finish,
+ soup_client_message_io_http2_skip,
soup_client_message_io_http2_is_open,
soup_client_message_io_http2_in_progress,
soup_client_message_io_http2_is_reusable
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index 098cda5e..18b748d1 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -173,22 +173,11 @@ soup_client_input_stream_close_fn (GInputStream *stream,
SoupClientInputStreamPrivate *priv = soup_client_input_stream_get_instance_private (cistream);
gboolean success;
- success = soup_message_io_run_until_finish (priv->msg, TRUE,
- NULL, error);
+ success = soup_message_io_skip (priv->msg, TRUE, cancellable, error);
soup_message_io_finished (priv->msg);
return success;
}
-static gboolean
-idle_finish_close (gpointer user_data)
-{
- GTask *task = user_data;
-
- g_task_return_boolean (task, TRUE);
- g_object_unref (task);
- return FALSE;
-}
-
static gboolean
close_async_ready (SoupMessage *msg, gpointer user_data)
{
@@ -197,9 +186,7 @@ close_async_ready (SoupMessage *msg, gpointer user_data)
SoupClientInputStreamPrivate *priv = soup_client_input_stream_get_instance_private (cistream);
GError *error = NULL;
- if (!soup_message_io_run_until_finish (priv->msg, FALSE,
- g_task_get_cancellable (task),
- &error) &&
+ if (!soup_message_io_skip (priv->msg, FALSE, g_task_get_cancellable (task), &error) &&
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
g_error_free (error);
return TRUE;
@@ -207,20 +194,11 @@ close_async_ready (SoupMessage *msg, gpointer user_data)
soup_message_io_finished (priv->msg);
- if (error) {
+ if (error)
g_task_return_error (task, error);
- g_object_unref (task);
- return FALSE;
- }
-
- /* Due to a historical accident, SoupSessionAsync relies on us
- * waiting one extra cycle after run_until_finish() returns.
- * Ugh. FIXME later when it's easier to do.
- */
- GSource *source = g_idle_source_new ();
- g_source_set_callback (source, idle_finish_close, task, NULL);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);
+ else
+ g_task_return_boolean (task, TRUE);
+ g_object_unref (task);
return FALSE;
}
diff --git a/libsoup/soup-client-message-io.c b/libsoup/soup-client-message-io.c
index 4847ce44..c9c78450 100644
--- a/libsoup/soup-client-message-io.c
+++ b/libsoup/soup-client-message-io.c
@@ -90,13 +90,13 @@ soup_client_message_io_run_until_read_async (SoupClientMessageIO *io,
}
gboolean
-soup_client_message_io_run_until_finish (SoupClientMessageIO *io,
- SoupMessage *msg,
- gboolean blocking,
- GCancellable *cancellable,
- GError **error)
+soup_client_message_io_skip (SoupClientMessageIO *io,
+ SoupMessage *msg,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error)
{
- return io->funcs->run_until_finish (io, msg, blocking, cancellable, error);
+ return io->funcs->skip (io, msg, blocking, cancellable, error);
}
GInputStream *
diff --git a/libsoup/soup-client-message-io.h b/libsoup/soup-client-message-io.h
index f8452a97..2a4d3b38 100644
--- a/libsoup/soup-client-message-io.h
+++ b/libsoup/soup-client-message-io.h
@@ -41,7 +41,7 @@ typedef struct {
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
- gboolean (*run_until_finish) (SoupClientMessageIO *io,
+ gboolean (*skip) (SoupClientMessageIO *io,
SoupMessage *msg,
gboolean blocking,
GCancellable *cancellable,
@@ -83,7 +83,7 @@ void soup_client_message_io_run_until_read_async (SoupClientMessageIO
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean soup_client_message_io_run_until_finish (SoupClientMessageIO *io,
+gboolean soup_client_message_io_skip (SoupClientMessageIO *io,
SoupMessage *msg,
gboolean blocking,
GCancellable *cancellable,
diff --git a/libsoup/soup-message-private.h b/libsoup/soup-message-private.h
index 37b8905f..8513c48f 100644
--- a/libsoup/soup-message-private.h
+++ b/libsoup/soup-message-private.h
@@ -52,7 +52,7 @@ void soup_message_io_unpause (SoupMessage *msg);
gboolean soup_message_is_io_paused (SoupMessage *msg);
gboolean soup_message_io_in_progress (SoupMessage *msg);
-gboolean soup_message_io_run_until_finish (SoupMessage *msg,
+gboolean soup_message_io_skip (SoupMessage *msg,
gboolean blocking,
GCancellable *cancellable,
GError **error);
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 46805b50..bd5d34d5 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -2280,14 +2280,14 @@ soup_message_io_run_until_read_finish (SoupMessage *msg,
}
gboolean
-soup_message_io_run_until_finish (SoupMessage *msg,
- gboolean blocking,
- GCancellable *cancellable,
- GError **error)
+soup_message_io_skip (SoupMessage *msg,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error)
{
SoupMessagePrivate *priv = soup_message_get_instance_private (msg);
- return soup_client_message_io_run_until_finish (priv->io_data, msg, blocking, cancellable, error);
+ return soup_client_message_io_skip (priv->io_data, msg, blocking, cancellable, error);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]