diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-11-06 14:06:01 +0100 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-11-06 14:35:22 +0100 |
commit | 97bb05552104615e1c9c9b53180e2f30a2ecb225 (patch) | |
tree | 4087e7550a6fa624d94ccb4547b42b4996de5922 /libsoup/soup-session.c | |
parent | 1827eeda856214b26b7222eb57b77b37558df334 (diff) | |
download | libsoup-carlosgc/message-flags.tar.gz |
message: remove SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS flagcarlosgc/message-flags
This was added for a very specific case of WebKit and it's no longer
needed. Nobody else seems to be using it and it complicates the
connection creation algorithm, so better remove it.
Diffstat (limited to 'libsoup/soup-session.c')
-rw-r--r-- | libsoup/soup-session.c | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index e427ffa4..c4b95bfe 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -892,7 +892,6 @@ soup_session_set_item_connection (SoupSession *session, { g_clear_object (&item->conn); item->conn = conn ? g_object_ref (conn) : NULL; - item->conn_is_dedicated = FALSE; soup_message_set_connection (item->msg, conn); } @@ -1127,14 +1126,11 @@ soup_session_unqueue_item (SoupSession *session, { SoupSessionPrivate *priv = soup_session_get_instance_private (session); SoupSessionHost *host; - SoupConnection *dedicated_conn = NULL; GSList *f; if (item->conn) { - if (item->conn_is_dedicated) - dedicated_conn = g_object_ref (item->conn); - else if (soup_message_get_method (item->msg) != SOUP_METHOD_CONNECT || - !SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (item->msg))) + if (soup_message_get_method (item->msg) != SOUP_METHOD_CONNECT || + !SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (item->msg))) soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE); soup_session_set_item_connection (session, item, NULL); } @@ -1149,21 +1145,9 @@ soup_session_unqueue_item (SoupSession *session, g_mutex_lock (&priv->conn_lock); host = get_host_for_message (session, item->msg); host->num_messages--; - if (dedicated_conn) { - /* FIXME: Do not drop the connection if current number of connections - * is no longer over the limits, just mark it as IDLE so it can be reused. - */ - g_hash_table_remove (priv->conns, dedicated_conn); - drop_connection (session, host, dedicated_conn); - } g_cond_broadcast (&priv->conn_cond); g_mutex_unlock (&priv->conn_lock); - if (dedicated_conn) { - soup_connection_disconnect (dedicated_conn); - g_object_unref (dedicated_conn); - } - /* g_signal_handlers_disconnect_by_func doesn't work if you * have a metamarshal, meaning it doesn't work with * soup_message_add_header_handler() @@ -1446,9 +1430,7 @@ get_connection_for_host (SoupSession *session, SoupMessageQueueItem *item, SoupSessionHost *host, gboolean need_new_connection, - gboolean ignore_connection_limits, - gboolean *try_cleanup, - gboolean *is_dedicated_connection) + gboolean *try_cleanup) { SoupSessionPrivate *priv = soup_session_get_instance_private (session); SoupConnection *conn; @@ -1476,30 +1458,18 @@ get_connection_for_host (SoupSession *session, /* Limit the number of pending connections; num_messages / 2 * is somewhat arbitrary... */ - if (num_pending > host->num_messages / 2) { - if (!ignore_connection_limits) - return NULL; - - *is_dedicated_connection = TRUE; - } + if (num_pending > host->num_messages / 2) + return NULL; if (host->num_conns >= priv->max_conns_per_host) { - if (!ignore_connection_limits) { - if (need_new_connection) - *try_cleanup = TRUE; - return NULL; - } - - *is_dedicated_connection = TRUE; + if (need_new_connection) + *try_cleanup = TRUE; + return NULL; } if (priv->num_conns >= priv->max_conns) { - if (!ignore_connection_limits) { - *try_cleanup = TRUE; - return NULL; - } - - *is_dedicated_connection = TRUE; + *try_cleanup = TRUE; + return NULL; } ensure_socket_props (session); @@ -1540,8 +1510,6 @@ get_connection (SoupMessageQueueItem *item, gboolean *should_cleanup) SoupConnection *conn = NULL; gboolean my_should_cleanup = FALSE; gboolean need_new_connection; - gboolean ignore_connection_limits; - gboolean is_dedicated_connection = FALSE; soup_session_cleanup_connections (session, FALSE); @@ -1549,17 +1517,13 @@ get_connection (SoupMessageQueueItem *item, gboolean *should_cleanup) (soup_message_query_flags (item->msg, SOUP_MESSAGE_NEW_CONNECTION)) || (!soup_message_query_flags (item->msg, SOUP_MESSAGE_IDEMPOTENT) && !SOUP_METHOD_IS_IDEMPOTENT (soup_message_get_method (item->msg))); - ignore_connection_limits = - soup_message_query_flags (item->msg, SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS); g_mutex_lock (&priv->conn_lock); host = get_host_for_message (session, item->msg); while (TRUE) { conn = get_connection_for_host (session, item, host, need_new_connection, - ignore_connection_limits, - &my_should_cleanup, - &is_dedicated_connection); + &my_should_cleanup); if (conn || item->async) break; @@ -1583,7 +1547,6 @@ get_connection (SoupMessageQueueItem *item, gboolean *should_cleanup) } soup_session_set_item_connection (session, item, conn); - item->conn_is_dedicated = is_dedicated_connection; if (soup_connection_get_state (item->conn) != SOUP_CONNECTION_NEW) { item->state = SOUP_MESSAGE_READY; |