When finishing up a queue item, SoupSession was always marking its
connection IDLE, even if it had previously been CONNECTING. This
created a race condition where if lots of pending connections were
cancelled at once, some of them might see connections labelled IDLE
that didn't actually have a SoupSocket (before those connections got
asynchronously cleaned up). Fix this by only marking connections IDLE
if they had previously been IN_USE.
https://bugzilla.gnome.org/show_bug.cgi?id=667245
SoupSessionHost *host;
if (item->conn) {
- soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE);
+ if (soup_connection_get_state (item->conn) == SOUP_CONNECTION_IN_USE)
+ soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE);
soup_message_queue_item_set_connection (item, NULL);
}