diff options
author | Patrick Griffis <pgriffis@igalia.com> | 2020-03-12 19:10:57 -0700 |
---|---|---|
committer | Patrick Griffis <pgriffis@igalia.com> | 2020-09-19 15:41:24 -0700 |
commit | 5dd1d1991d476f44180e2f177e06a6477100e530 (patch) | |
tree | 74f5e2fb0022fb50f5a42f24e2ed5bc3b9e9ecf9 /libsoup | |
parent | 635a4efeacc6f489e13af19a35c80456629f8121 (diff) | |
download | libsoup-5dd1d1991d476f44180e2f177e06a6477100e530.tar.gz |
Delete SoupSessionSync
Diffstat (limited to 'libsoup')
-rw-r--r-- | libsoup/content-sniffer/soup-content-decoder.c | 3 | ||||
-rw-r--r-- | libsoup/include/soup-installed.h | 1 | ||||
-rw-r--r-- | libsoup/meson.build | 2 | ||||
-rw-r--r-- | libsoup/soup-autocleanups.h | 1 | ||||
-rw-r--r-- | libsoup/soup-message-client-io.c | 10 | ||||
-rw-r--r-- | libsoup/soup-message-io.c | 14 | ||||
-rw-r--r-- | libsoup/soup-message.c | 5 | ||||
-rw-r--r-- | libsoup/soup-request-http.c | 2 | ||||
-rw-r--r-- | libsoup/soup-request.c | 3 | ||||
-rw-r--r-- | libsoup/soup-session-sync.c | 132 | ||||
-rw-r--r-- | libsoup/soup-session-sync.h | 60 | ||||
-rw-r--r-- | libsoup/soup-session.c | 95 | ||||
-rw-r--r-- | libsoup/soup-types.h | 1 | ||||
-rw-r--r-- | libsoup/soup.h | 1 |
14 files changed, 12 insertions, 318 deletions
diff --git a/libsoup/content-sniffer/soup-content-decoder.c b/libsoup/content-sniffer/soup-content-decoder.c index a9b9e768..c0155786 100644 --- a/libsoup/content-sniffer/soup-content-decoder.c +++ b/libsoup/content-sniffer/soup-content-decoder.c @@ -27,8 +27,7 @@ * incoming ones. Currently it supports the "gzip", "deflate", and "br" * content codings. * - * If you are using a plain #SoupSession (ie, not #SoupSessionAsync or - * #SoupSessionSync), then a #SoupContentDecoder will automatically be + * A #SoupContentDecoder will automatically be * added to the session by default. (You can use * %SOUP_SESSION_REMOVE_FEATURE_BY_TYPE at construct time if you don't * want this.) If you are using one of the deprecated #SoupSession diff --git a/libsoup/include/soup-installed.h b/libsoup/include/soup-installed.h index 56fa31fe..0743301d 100644 --- a/libsoup/include/soup-installed.h +++ b/libsoup/include/soup-installed.h @@ -44,7 +44,6 @@ extern "C" { #include <libsoup/soup-server.h> #include <libsoup/soup-session-async.h> #include <libsoup/soup-session-feature.h> -#include <libsoup/soup-session-sync.h> #include <libsoup/soup-socket.h> #include <libsoup/soup-status.h> #include <libsoup/soup-tld.h> diff --git a/libsoup/meson.build b/libsoup/meson.build index ac7f6b84..3c859d95 100644 --- a/libsoup/meson.build +++ b/libsoup/meson.build @@ -81,7 +81,6 @@ soup_sources = [ 'soup-session.c', 'soup-session-async.c', 'soup-session-feature.c', - 'soup-session-sync.c', 'soup-socket.c', 'soup-socket-properties.c', 'soup-status.c', @@ -180,7 +179,6 @@ soup_introspection_headers = [ 'soup-session.h', 'soup-session-async.h', 'soup-session-feature.h', - 'soup-session-sync.h', 'soup-socket.h', 'soup-status.h', 'soup-tld.h', diff --git a/libsoup/soup-autocleanups.h b/libsoup/soup-autocleanups.h index 1895eb0c..18b5c72e 100644 --- a/libsoup/soup-autocleanups.h +++ b/libsoup/soup-autocleanups.h @@ -55,7 +55,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupServer, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSession, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionAsync, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionFeature, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSessionSync, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupSocket, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupURI, soup_uri_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(SoupWebsocketConnection, g_object_unref) diff --git a/libsoup/soup-message-client-io.c b/libsoup/soup-message-client-io.c index 1a60360f..9fba1958 100644 --- a/libsoup/soup-message-client-io.c +++ b/libsoup/soup-message-client-io.c @@ -146,12 +146,10 @@ soup_message_send_request (SoupMessageQueueItem *item, GMainContext *async_context; GIOStream *iostream; - if (!SOUP_IS_SESSION_SYNC (item->session)) { - async_context = soup_session_get_async_context (item->session); - if (!async_context) - async_context = g_main_context_default (); - } else - async_context = NULL; + async_context = soup_session_get_async_context (item->session); + if (!async_context) + async_context = g_main_context_default (); + iostream = soup_socket_get_iostream (soup_connection_get_socket (item->conn)); soup_message_io_client (item, iostream, async_context, diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c index 1a15d004..78578acc 100644 --- a/libsoup/soup-message-io.c +++ b/libsoup/soup-message-io.c @@ -568,13 +568,11 @@ io_write (SoupMessage *msg, gboolean blocking, g_clear_object (&io->body_ostream); } else { io->async_close_wait = g_cancellable_new (); - if (io->async_context) - g_main_context_push_thread_default (io->async_context); + g_main_context_push_thread_default (io->async_context); g_output_stream_close_async (io->body_ostream, G_PRIORITY_DEFAULT, cancellable, closed_async, g_object_ref (msg)); - if (io->async_context) - g_main_context_pop_thread_default (io->async_context); + g_main_context_pop_thread_default (io->async_context); } } @@ -1200,9 +1198,7 @@ new_iostate (SoupMessage *msg, GIOStream *iostream, io->iostream = g_object_ref (iostream); io->istream = SOUP_FILTER_INPUT_STREAM (g_io_stream_get_input_stream (iostream)); io->ostream = g_io_stream_get_output_stream (iostream); - - if (async_context) - io->async_context = g_main_context_ref (async_context); + io->async_context = g_main_context_ref (async_context); io->read_header_buf = g_byte_array_new (); io->write_buf = g_string_new (NULL); @@ -1248,9 +1244,7 @@ soup_message_io_client (SoupMessageQueueItem *item, io->write_state = SOUP_MESSAGE_IO_STATE_HEADERS; if (!item->new_api) { - gboolean blocking = - SOUP_IS_SESSION_SYNC (item->session) || - (!SOUP_IS_SESSION_ASYNC (item->session) && !item->async); + gboolean blocking = !SOUP_IS_SESSION_ASYNC (item->session) && !item->async; io_run (item->msg, blocking); } } diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c index 3acf1e42..ae0bb0bc 100644 --- a/libsoup/soup-message.c +++ b/libsoup/soup-message.c @@ -2192,9 +2192,8 @@ soup_message_get_soup_request (SoupMessage *msg) * message with lower priority (messages with the same priority are * processed on a FIFO basis). * - * Setting priorities does not currently work with #SoupSessionSync - * (or with synchronous messages on a plain #SoupSession) because in - * the synchronous/blocking case, priority ends up being determined + * Setting priorities does not currently work with synchronous messages + * because in the synchronous/blocking case, priority ends up being determined * semi-randomly by thread scheduling. * * Since: 2.44 diff --git a/libsoup/soup-request-http.c b/libsoup/soup-request-http.c index 285f59d7..d582eb67 100644 --- a/libsoup/soup-request-http.c +++ b/libsoup/soup-request-http.c @@ -137,8 +137,6 @@ soup_request_http_send_async (SoupRequest *request, SoupSession *session = soup_request_get_session (request); GTask *task; - g_return_if_fail (!SOUP_IS_SESSION_SYNC (session)); - task = g_task_new (request, cancellable, callback, user_data); soup_session_send_async (session, http->priv->msg, cancellable, http_input_stream_ready_cb, task); diff --git a/libsoup/soup-request.c b/libsoup/soup-request.c index a8d19ddc..b06d4aea 100644 --- a/libsoup/soup-request.c +++ b/libsoup/soup-request.c @@ -229,9 +229,6 @@ soup_request_send (SoupRequest *request, * Begins an asynchronously request for the URI pointed to by * @request. * - * Note that you cannot use this method with #SoupRequests attached to - * a #SoupSessionSync. - * * Since: 2.42 */ void diff --git a/libsoup/soup-session-sync.c b/libsoup/soup-session-sync.c deleted file mode 100644 index 229ac1e5..00000000 --- a/libsoup/soup-session-sync.c +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * soup-session-sync.c - * - * Copyright (C) 2000-2003, Ximian, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "soup-session-sync.h" -#include "soup.h" -#include "soup-session-private.h" -#include "soup-message-private.h" -#include "soup-message-queue.h" - -/** - * SECTION:soup-session-sync - * @short_description: SoupSession for blocking I/O in multithreaded programs - * (deprecated). - * - * #SoupSessionSync is an implementation of #SoupSession that uses - * synchronous I/O, intended for use in multi-threaded programs. - * - * Deprecated: 2.42: Use the #SoupSession class (which uses both asynchronous - * and synchronous I/O, depending on the API used). See the - * <link linkend="libsoup-session-porting">porting guide</link>. - **/ - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - -G_DEFINE_TYPE (SoupSessionSync, soup_session_sync, SOUP_TYPE_SESSION) - -static void -soup_session_sync_init (SoupSessionSync *ss) -{ -} - -/** - * soup_session_sync_new: - * - * Creates an synchronous #SoupSession with the default options. - * - * Return value: the new session. - * - * Deprecated: #SoupSessionSync is deprecated; use a plain - * #SoupSession, created with soup_session_new(). See the <link - * linkend="libsoup-session-porting">porting guide</link>. - **/ -SoupSession * -soup_session_sync_new (void) -{ - return g_object_new (SOUP_TYPE_SESSION_SYNC, NULL); -} - -/** - * soup_session_sync_new_with_options: - * @optname1: name of first property to set - * @...: value of @optname1, followed by additional property/value pairs - * - * Creates an synchronous #SoupSession with the specified options. - * - * Return value: the new session. - * - * Deprecated: #SoupSessionSync is deprecated; use a plain - * #SoupSession, created with soup_session_new_with_options(). See the - * <link linkend="libsoup-session-porting">porting guide</link>. - **/ -SoupSession * -soup_session_sync_new_with_options (const char *optname1, ...) -{ - SoupSession *session; - va_list ap; - - va_start (ap, optname1); - session = (SoupSession *)g_object_new_valist (SOUP_TYPE_SESSION_SYNC, - optname1, ap); - va_end (ap); - - return session; -} - -static gboolean -queue_message_callback (gpointer data) -{ - SoupMessageQueueItem *item = data; - - item->callback (item->session, item->msg, item->callback_data); - soup_message_queue_item_unref (item); - return FALSE; -} - -static gpointer -queue_message_thread (gpointer data) -{ - SoupMessageQueueItem *item = data; - - soup_session_process_queue_item (item->session, item, NULL, TRUE); - if (item->callback) { - soup_add_completion (soup_session_get_async_context (item->session), - queue_message_callback, item); - } else - soup_message_queue_item_unref (item); - - return NULL; -} - -static void -soup_session_sync_queue_message (SoupSession *session, SoupMessage *msg, - SoupSessionCallback callback, gpointer user_data) -{ - SoupMessageQueueItem *item; - GThread *thread; - - item = soup_session_append_queue_item (session, msg, FALSE, FALSE, - callback, user_data); - thread = g_thread_new ("SoupSessionSync:queue_message", - queue_message_thread, item); - g_thread_unref (thread); -} - -static void -soup_session_sync_class_init (SoupSessionSyncClass *session_sync_class) -{ - SoupSessionClass *session_class = SOUP_SESSION_CLASS (session_sync_class); - - /* virtual method override */ - session_class->queue_message = soup_session_sync_queue_message; -} - -G_GNUC_END_IGNORE_DEPRECATIONS; diff --git a/libsoup/soup-session-sync.h b/libsoup/soup-session-sync.h deleted file mode 100644 index 360f21bc..00000000 --- a/libsoup/soup-session-sync.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000-2003, Ximian, Inc. - */ - -#ifndef __SOUP_SESSION_SYNC_H__ -#define __SOUP_SESSION_SYNC_H__ 1 - -#include "soup-types.h" -#include "soup-session.h" - -G_BEGIN_DECLS - -#define SOUP_TYPE_SESSION_SYNC (soup_session_sync_get_type ()) -#define SOUP_SESSION_SYNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SESSION_SYNC, SoupSessionSync)) -#define SOUP_SESSION_SYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SESSION_SYNC, SoupSessionSyncClass)) -#define SOUP_IS_SESSION_SYNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), _soup_session_sync_get_type_undeprecated ())) -#define SOUP_IS_SESSION_SYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SESSION_SYNC)) -#define SOUP_SESSION_SYNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SESSION_SYNC, SoupSessionSyncClass)) - -struct _SoupSessionSync { - SoupSession parent; - -}; - -typedef struct { - SoupSessionClass parent_class; - - /* Padding for future expansion */ - void (*_libsoup_reserved1) (void); - void (*_libsoup_reserved2) (void); - void (*_libsoup_reserved3) (void); - void (*_libsoup_reserved4) (void); -} SoupSessionSyncClass; - -SOUP_AVAILABLE_IN_2_4 -SOUP_DEPRECATED_IN_2_54 -GType soup_session_sync_get_type (void); - -static inline GType -_soup_session_sync_get_type_undeprecated (void) -{ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - return soup_session_sync_get_type (); - G_GNUC_END_IGNORE_DEPRECATIONS; -} - -#ifndef SOUP_DISABLE_DEPRECATED -SOUP_AVAILABLE_IN_2_4 -SOUP_DEPRECATED_IN_2_54_FOR(soup_session_new) -SoupSession *soup_session_sync_new (void); -SOUP_AVAILABLE_IN_2_4 -SOUP_DEPRECATED_IN_2_54_FOR(soup_session_new_with_options) -SoupSession *soup_session_sync_new_with_options (const char *optname1, - ...) G_GNUC_NULL_TERMINATED; -#endif - -G_END_DECLS - -#endif /* __SOUP_SESSION_SYNC_H__ */ diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 007f7da7..22a1ded7 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -46,17 +46,6 @@ * one session for the first user, and a second session for the other * user.) * - * In the past, #SoupSession was an abstract class, and users needed - * to choose between #SoupSessionAsync (which always uses - * #GMainLoop<!-- -->-based I/O), or #SoupSessionSync (which always uses - * blocking I/O and can be used from multiple threads simultaneously). - * This is no longer necessary; you can (and should) use a plain - * #SoupSession, which supports both synchronous and asynchronous use. - * (When using a plain #SoupSession, soup_session_queue_message() - * behaves like it traditionally did on a #SoupSessionAsync, and - * soup_session_send_message() behaves like it traditionally did on a - * #SoupSessionSync.) - * * Additional #SoupSession functionality is provided by * #SoupSessionFeature objects, which can be added to a session with * soup_session_add_feature() or soup_session_add_feature_by_type() @@ -1973,13 +1962,6 @@ soup_session_real_queue_message (SoupSession *session, SoupMessage *msg, * be invoked. If after returning from this callback the message has not * been requeued, @msg will be unreffed. * - * (The behavior above applies to a plain #SoupSession; if you are - * using #SoupSessionAsync or #SoupSessionSync, then the #GMainContext - * that is used depends on the settings of #SoupSession:async-context - * and #SoupSession:use-thread-context, and for #SoupSessionSync, the - * message will actually be sent and processed in another thread, with - * only the final callback occurring in the indicated #GMainContext.) - * * Contrast this method with soup_session_send_async(), which also * asynchronously sends a message, but returns before reading the * response body, and allows you to read the response via a @@ -2288,17 +2270,6 @@ soup_session_real_flush_queue (SoupSession *session) { SoupSessionPrivate *priv = soup_session_get_instance_private (session); SoupMessageQueueItem *item; - GHashTable *current = NULL; - gboolean done = FALSE; - - if (SOUP_IS_SESSION_SYNC (session)) { - /* Record the current contents of the queue */ - current = g_hash_table_new (NULL, NULL); - for (item = soup_message_queue_first (priv->queue); - item; - item = soup_message_queue_next (priv->queue, item)) - g_hash_table_insert (current, item, item); - } /* Cancel everything */ for (item = soup_message_queue_first (priv->queue); @@ -2307,33 +2278,6 @@ soup_session_real_flush_queue (SoupSession *session) soup_session_cancel_message (session, item->msg, SOUP_STATUS_CANCELLED); } - - if (SOUP_IS_SESSION_SYNC (session)) { - /* Wait until all of the items in @current have been - * removed from the queue. (This is not the same as - * "wait for the queue to be empty", because the app - * may queue new requests in response to the - * cancellation of the old ones. We don't try to - * cancel those requests as well, since we'd likely - * just end up looping forever.) - */ - g_mutex_lock (&priv->conn_lock); - do { - done = TRUE; - for (item = soup_message_queue_first (priv->queue); - item; - item = soup_message_queue_next (priv->queue, item)) { - if (g_hash_table_lookup (current, item)) - done = FALSE; - } - - if (!done) - g_cond_wait (&priv->conn_cond, &priv->conn_lock); - } while (!done); - g_mutex_unlock (&priv->conn_lock); - - g_hash_table_destroy (current); - } } /** @@ -3040,11 +2984,6 @@ soup_session_class_init (SoupSessionClass *session_class) * if you want to ensure that all future connections will have * this timeout value. * - * Note that the default value of 60 seconds only applies to - * plain #SoupSessions. If you are using #SoupSessionAsync or - * #SoupSessionSync, the default value is 0 (meaning idle - * connections will never time out). - * * Since: 2.24 **/ /** @@ -3086,11 +3025,6 @@ soup_session_class_init (SoupSessionClass *session_class) * See #SoupSession:ssl-strict for more information on how * https certificate validation is handled. * - * Note that the default value of %TRUE only applies to plain - * #SoupSessions. If you are using #SoupSessionAsync or - * #SoupSessionSync, the default value is %FALSE, for backward - * compatibility. - * * Since: 2.38 **/ g_object_class_install_property ( @@ -3122,12 +3056,6 @@ soup_session_class_init (SoupSessionClass *session_class) * See #SoupSession:ssl-strict for more information on how * https certificate validation is handled. * - * If you are using a plain #SoupSession then - * #SoupSession:ssl-use-system-ca-file will be %TRUE by - * default, and so this property will be a copy of the system - * CA database. If you are using #SoupSessionAsync or - * #SoupSessionSync, this property will be %NULL by default. - * * Since: 2.38 **/ g_object_class_install_property ( @@ -3165,11 +3093,7 @@ soup_session_class_init (SoupSessionClass *session_class) * * For a plain #SoupSession, if the session has no CA file or * TLS database, and this property is %TRUE, then all - * certificates will be rejected. However, beware that the - * deprecated #SoupSession subclasses (#SoupSessionAsync and - * #SoupSessionSync) have the opposite behavior: if there is - * no CA file or TLS database, then all certificates are always - * accepted, and this property has no effect. + * certificates will be rejected. * * Since: 2.30 */ @@ -3249,11 +3173,6 @@ soup_session_class_init (SoupSessionClass *session_class) * if you want to ensure that all future connections will have * this timeout value. * - * Note that the default value of 60 seconds only applies to - * plain #SoupSessions. If you are using #SoupSessionAsync or - * #SoupSessionSync, the default value is 0 (meaning socket I/O - * will not time out). - * * Not to be confused with #SoupSession:idle-timeout (which is * the length of time that idle persistent connections will be * kept open). @@ -3449,11 +3368,6 @@ soup_session_class_init (SoupSessionClass *session_class) * * In a plain #SoupSession, the default value is %NULL, * meaning that only "http" is recognized as meaning "http". - * In #SoupSessionAsync and #SoupSessionSync, for backward - * compatibility, the default value is an array containing the - * single element <literal>"*"</literal>, a special value - * which means that any scheme except "https" is considered to - * be an alias for "http". * * See also #SoupSession:https-aliases. * @@ -3986,11 +3900,6 @@ cancel_cancellable (G_GNUC_UNUSED GCancellable *cancellable, GCancellable *chain * asynchronously sends a #SoupMessage, but doesn't invoke its * callback until the response has been completely read. * - * (Note that this method cannot be called on the deprecated - * #SoupSessionSync subclass, and can only be called on - * #SoupSessionAsync if you have set the - * #SoupSession:use-thread-context property.) - * * Since: 2.42 */ void @@ -4004,7 +3913,6 @@ soup_session_send_async (SoupSession *session, gboolean use_thread_context; g_return_if_fail (SOUP_IS_SESSION (session)); - g_return_if_fail (!SOUP_IS_SESSION_SYNC (session)); g_object_get (G_OBJECT (session), SOUP_SESSION_USE_THREAD_CONTEXT, &use_thread_context, @@ -4065,7 +3973,6 @@ soup_session_send_finish (SoupSession *session, GTask *task; g_return_val_if_fail (SOUP_IS_SESSION (session), NULL); - g_return_val_if_fail (!SOUP_IS_SESSION_SYNC (session), NULL); g_return_val_if_fail (g_task_is_valid (result, session), NULL); task = G_TASK (result); diff --git a/libsoup/soup-types.h b/libsoup/soup-types.h index 89e077a6..6106d9c4 100644 --- a/libsoup/soup-types.h +++ b/libsoup/soup-types.h @@ -30,7 +30,6 @@ typedef struct _SoupServer SoupServer; typedef struct _SoupSession SoupSession; typedef struct _SoupSessionAsync SoupSessionAsync; typedef struct _SoupSessionFeature SoupSessionFeature; -typedef struct _SoupSessionSync SoupSessionSync; typedef struct _SoupSocket SoupSocket; typedef struct _SoupURI SoupURI; typedef struct _SoupWebsocketConnection SoupWebsocketConnection; diff --git a/libsoup/soup.h b/libsoup/soup.h index c0131d9f..b8fedbaa 100644 --- a/libsoup/soup.h +++ b/libsoup/soup.h @@ -44,7 +44,6 @@ extern "C" { #include "soup-server.h" #include "soup-session-async.h" #include "soup-session-feature.h" -#include "soup-session-sync.h" #include "soup-socket.h" #include "soup-status.h" #include "soup-tld.h" |