summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2022-04-20 14:27:17 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2022-06-08 12:36:17 +0200
commitfeed52e8f0e997d5ca4c36151cb90347575fa41d (patch)
tree99da88c74d7303d2ce1d8355ba5569a4d2411683
parent2479d9f7ea17a4f8311e3fc73c6dffa3e59349c4 (diff)
downloadlibsoup-feed52e8f0e997d5ca4c36151cb90347575fa41d.tar.gz
session: remove the features cache
It's not thread safe and it's accessed by message IO from multiple threads. Session features are not that many so iterating every time should be fast enough.
-rw-r--r--libsoup/soup-session.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 4cd942e7..9d8b15d4 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -96,7 +96,6 @@ typedef struct {
gboolean accept_language_auto;
GSList *features;
- GHashTable *features_cache;
SoupConnectionManager *conn_manager;
} SoupSessionPrivate;
@@ -283,8 +282,6 @@ soup_session_init (SoupSession *session)
SOUP_SESSION_MAX_CONNS_DEFAULT,
SOUP_SESSION_MAX_CONNS_PER_HOST_DEFAULT);
- priv->features_cache = g_hash_table_new (NULL, NULL);
-
auth_manager = g_object_new (SOUP_TYPE_AUTH_MANAGER, NULL);
soup_session_feature_add_feature (SOUP_SESSION_FEATURE (auth_manager),
SOUP_TYPE_AUTH_BASIC);
@@ -355,8 +352,6 @@ soup_session_finalize (GObject *object)
g_clear_object (&priv->local_addr);
- g_hash_table_destroy (priv->features_cache);
-
g_clear_object (&priv->proxy_resolver);
g_clear_pointer (&priv->socket_props, soup_socket_properties_unref);
@@ -2008,7 +2003,6 @@ soup_session_add_feature (SoupSession *session, SoupSessionFeature *feature)
return;
priv->features = g_slist_prepend (priv->features, g_object_ref (feature));
- g_hash_table_remove_all (priv->features_cache);
soup_session_feature_attach (feature, session);
}
@@ -2076,7 +2070,6 @@ soup_session_remove_feature (SoupSession *session, SoupSessionFeature *feature)
priv = soup_session_get_instance_private (session);
if (g_slist_find (priv->features, feature)) {
priv->features = g_slist_remove (priv->features, feature);
- g_hash_table_remove_all (priv->features_cache);
soup_session_feature_detach (feature, session);
g_object_unref (feature);
}
@@ -2203,19 +2196,10 @@ soup_session_get_feature (SoupSession *session, GType feature_type)
priv = soup_session_get_instance_private (session);
- feature = g_hash_table_lookup (priv->features_cache,
- GSIZE_TO_POINTER (feature_type));
- if (feature)
- return feature;
-
for (f = priv->features; f; f = f->next) {
feature = f->data;
- if (G_TYPE_CHECK_INSTANCE_TYPE (feature, feature_type)) {
- g_hash_table_insert (priv->features_cache,
- GSIZE_TO_POINTER (feature_type),
- feature);
+ if (G_TYPE_CHECK_INSTANCE_TYPE (feature, feature_type))
return feature;
- }
}
return NULL;
}