diff options
| author | Dan Winship <danw@gnome.org> | 2014-05-02 15:37:38 -0400 |
|---|---|---|
| committer | Dan Winship <danw@gnome.org> | 2014-05-02 15:37:38 -0400 |
| commit | ba5f2e307b2ee45f4cc166f6b488c7bc8559bfc7 (patch) | |
| tree | b1b37c7fae6b7df2e997c179007260596ecf84c4 | |
| parent | 2e28875a3ba7e0302cb181a85b7681d6b32ffd1b (diff) | |
| download | libsoup-ba5f2e307b2ee45f4cc166f6b488c7bc8559bfc7.tar.gz | |
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
| -rw-r--r-- | 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 6deff7ed..cbefc647 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); |
