summaryrefslogtreecommitdiff
path: root/libsoup
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2023-01-31 12:16:16 +0100
committerCarlos Garcia Campos <cgarcia@igalia.com>2023-02-03 09:37:47 +0100
commit7df98880b4273308b043d632682cc2daa55319ea (patch)
treec09ef290ddef3a687b0120fc9db70f043c0ffb7e /libsoup
parentb417b284915cf0066d7c94aec018fe6489da6946 (diff)
downloadlibsoup-7df98880b4273308b043d632682cc2daa55319ea.tar.gz
Do not wait for the next loop iteration to unqueue async items
This way we release the connection earlier, since other requests might be waiting for the connection. We can also remove manual loop iterations in the tests after a request is done.
Diffstat (limited to 'libsoup')
-rw-r--r--libsoup/soup-session.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index cbc00b9d..4d4c8654 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1471,9 +1471,7 @@ message_completed (SoupMessage *msg, SoupMessageIOCompletion completion, gpointe
if (item->state != SOUP_MESSAGE_RESTARTING) {
item->state = SOUP_MESSAGE_FINISHING;
-
- if (!item->async)
- soup_session_process_queue_item (item->session, item, TRUE);
+ soup_session_process_queue_item (item->session, item, !item->async);
}
}
@@ -3643,8 +3641,6 @@ soup_session_get_supported_websocket_extensions_for_message (SoupSession *sessio
return soup_websocket_extension_manager_get_supported_extensions (SOUP_WEBSOCKET_EXTENSION_MANAGER (extension_manager));
}
-static void websocket_connect_async_stop (SoupMessage *msg, gpointer user_data);
-
static void
websocket_connect_async_complete (SoupMessage *msg, gpointer user_data)
{
@@ -3677,11 +3673,10 @@ websocket_connect_async_stop (SoupMessage *msg, gpointer user_data)
GList *accepted_extensions = NULL;
GError *error = NULL;
- g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, task);
-
supported_extensions = soup_session_get_supported_websocket_extensions_for_message (session, msg);
if (soup_websocket_client_verify_handshake (item->msg, supported_extensions, &accepted_extensions, &error)) {
+ g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, task);
stream = soup_session_steal_connection (item->session, item->msg);
client = soup_websocket_connection_new (stream,
soup_message_get_uri (item->msg),
@@ -3696,9 +3691,9 @@ websocket_connect_async_stop (SoupMessage *msg, gpointer user_data)
return;
}
- soup_message_io_finished (item->msg);
- g_task_return_error (task, error);
- g_object_unref (task);
+ g_assert (!item->error);
+ item->error = error;
+ soup_message_io_finished (item->msg);
}
/**