[libsoup] soup-session: fix connection-closing behavior on abort
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-session: fix connection-closing behavior on abort
- Date: Fri, 2 May 2014 19:40:08 +0000 (UTC)
commit ba5f2e307b2ee45f4cc166f6b488c7bc8559bfc7
Author: Dan Winship <danw gnome org>
Date: Fri May 2 15:37:38 2014 -0400
soup-session: fix connection-closing behavior on abort
soup_session_abort()'s docs claim that it closes "all idle persistent
connections", but it was actually trying to close *all* connections,
including ones that were being actively used in other threads. Fix
that.
https://bugzilla.redhat.com/show_bug.cgi?id=1093314
libsoup/soup-session.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 6deff7e..cbefc64 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -2482,14 +2482,20 @@ soup_session_abort (SoupSession *session)
SOUP_SESSION_GET_CLASS (session)->flush_queue (session);
- /* Close all connections */
+ /* Close all idle connections */
g_mutex_lock (&priv->conn_lock);
conns = NULL;
g_hash_table_iter_init (&iter, priv->conns);
while (g_hash_table_iter_next (&iter, &conn, &host)) {
- conns = g_slist_prepend (conns, g_object_ref (conn));
- g_hash_table_iter_remove (&iter);
- drop_connection (session, host, conn);
+ SoupConnectionState state;
+
+ state = soup_connection_get_state (conn);
+ if (state == SOUP_CONNECTION_IDLE ||
+ state == SOUP_CONNECTION_REMOTE_DISCONNECTED) {
+ conns = g_slist_prepend (conns, g_object_ref (conn));
+ g_hash_table_iter_remove (&iter);
+ drop_connection (session, host, conn);
+ }
}
g_mutex_unlock (&priv->conn_lock);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]