[libsoup/carlosgc/requeue-private: 2/3] session: remove soup_session_get_queue




commit db1a399ac3bf52d21bc1999cc05d7e7fd2fafc55
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Wed Sep 30 11:42:16 2020 +0200

    session: remove soup_session_get_queue
    
    It's only used by the auth manger to get the message proxy uri. Add
    soup_session_get_message_proxy_uri() instead that already returns the
    proxy uri to simplify it.

 libsoup/auth/soup-auth-manager.c | 13 +------------
 libsoup/soup-session-private.h   |  8 +++-----
 libsoup/soup-session.c           | 26 ++++++++++++++++++--------
 3 files changed, 22 insertions(+), 25 deletions(-)
---
diff --git a/libsoup/auth/soup-auth-manager.c b/libsoup/auth/soup-auth-manager.c
index 225b85d9..34780b05 100644
--- a/libsoup/auth/soup-auth-manager.c
+++ b/libsoup/auth/soup-auth-manager.c
@@ -15,7 +15,6 @@
 #include "soup.h"
 #include "soup-connection-auth.h"
 #include "soup-message-private.h"
-#include "soup-message-queue.h"
 #include "soup-path-map.h"
 #include "soup-session-private.h"
 
@@ -523,17 +522,7 @@ authenticate_auth (SoupAuthManager *manager, SoupAuth *auth,
                return;
 
        if (proxy) {
-               SoupMessageQueue *queue;
-               SoupMessageQueueItem *item;
-
-               queue = soup_session_get_queue (priv->session);
-               item = soup_message_queue_lookup (queue, msg);
-               if (!item)
-                       return;
-
-               /* When loaded from the disk cache, the connection is NULL. */
-               uri = item->conn ? soup_connection_get_proxy_uri (item->conn) : NULL;
-               soup_message_queue_item_unref (item);
+               uri = soup_session_get_message_proxy_uri (priv->session, msg);
                if (!uri)
                        return;
        } else
diff --git a/libsoup/soup-session-private.h b/libsoup/soup-session-private.h
index 3272301b..3802dfc3 100644
--- a/libsoup/soup-session-private.h
+++ b/libsoup/soup-session-private.h
@@ -7,14 +7,12 @@
 #define __SOUP_SESSION_PRIVATE_H__ 1
 
 #include "soup-session.h"
-#include "soup-message-private.h"
+#include "soup-uri.h"
 
 G_BEGIN_DECLS
 
-/* "protected" methods for subclasses */
-SoupMessageQueue     *soup_session_get_queue            (SoupSession          *session);
-
-
+SoupURI *soup_session_get_message_proxy_uri (SoupSession *session,
+                                            SoupMessage *msg);
 
 G_END_DECLS
 
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 1ae7aba2..c674cbfe 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1179,14 +1179,6 @@ connection_state_changed (GObject *object, GParamSpec *param, gpointer user_data
                soup_session_kick_queue (session);
 }
 
-SoupMessageQueue *
-soup_session_get_queue (SoupSession *session)
-{
-       SoupSessionPrivate *priv = soup_session_get_instance_private (session);
-
-       return priv->queue;
-}
-
 static void
 soup_session_unqueue_item (SoupSession          *session,
                           SoupMessageQueueItem *item)
@@ -4183,3 +4175,21 @@ soup_session_websocket_connect_finish (SoupSession      *session,
 
        return g_task_propagate_pointer (G_TASK (result), error);
 }
+
+SoupURI *
+soup_session_get_message_proxy_uri (SoupSession *session,
+                                   SoupMessage *msg)
+{
+       SoupSessionPrivate *priv = soup_session_get_instance_private (session);
+       SoupMessageQueueItem *item;
+       SoupURI *uri;
+
+       item = soup_message_queue_lookup (priv->queue, msg);
+       if (!item)
+               return NULL;
+
+       /* When loaded from the disk cache, the connection is NULL. */
+       uri = item->conn ? soup_connection_get_proxy_uri (item->conn) : NULL;
+       soup_message_queue_item_unref (item);
+       return uri;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]