summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libsoup/soup-connection.c22
-rw-r--r--libsoup/soup-session.c2
2 files changed, 5 insertions, 19 deletions
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 21613946..a6ed5243 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -474,8 +474,6 @@ socket_connect_finished (SoupSocket *socket, guint status, gpointer user_data)
status = soup_status_proxify (status);
data->callback (data->conn, status, data->callback_data);
}
- if (!SOUP_STATUS_IS_SUCCESSFUL (status) && status != SOUP_STATUS_TRY_AGAIN)
- soup_connection_disconnect (data->conn);
g_object_unref (data->conn);
if (data->cancellable)
g_object_unref (data->cancellable);
@@ -641,6 +639,7 @@ soup_connection_connect_sync (SoupConnection *conn, GCancellable *cancellable)
SOUP_SOCKET_CLEAN_DISPOSE, TRUE,
NULL);
g_object_unref (remote_addr);
+
event_id = g_signal_connect (priv->socket, "event",
G_CALLBACK (proxy_socket_event), conn);
status = soup_socket_connect_sync (priv->socket, cancellable);
@@ -679,17 +678,9 @@ soup_connection_connect_sync (SoupConnection *conn, GCancellable *cancellable)
soup_connection_set_state (conn, SOUP_CONNECTION_IN_USE);
priv->unused_timeout = time (NULL) + SOUP_CONNECTION_UNUSED_TIMEOUT;
start_idle_timer (conn);
- } else if (status != SOUP_STATUS_TRY_AGAIN) {
- fail:
- if (priv->socket) {
- soup_socket_disconnect (priv->socket);
- g_object_unref (priv->socket);
- priv->socket = NULL;
- }
-
- soup_connection_disconnect (conn);
}
+ fail:
if (priv->socket && event_id)
g_signal_handler_disconnect (priv->socket, event_id);
@@ -721,10 +712,8 @@ soup_connection_start_ssl_sync (SoupConnection *conn,
if (!soup_socket_start_proxy_ssl (priv->socket,
priv->remote_uri->host,
- cancellable)) {
- soup_connection_disconnect (conn);
+ cancellable))
return SOUP_STATUS_SSL_FAILED;
- }
soup_connection_event (conn, G_SOCKET_CLIENT_TLS_HANDSHAKING, NULL);
status = soup_socket_handshake_sync (priv->socket, cancellable);
@@ -736,9 +725,6 @@ soup_connection_start_ssl_sync (SoupConnection *conn,
status = SOUP_STATUS_TRY_AGAIN;
}
- if (!SOUP_STATUS_IS_SUCCESSFUL (status) && status != SOUP_STATUS_TRY_AGAIN)
- soup_connection_disconnect (conn);
-
return status;
}
@@ -757,8 +743,6 @@ start_ssl_completed (SoupSocket *socket, guint status, gpointer user_data)
}
data->callback (data->conn, status, data->callback_data);
- if (!SOUP_STATUS_IS_SUCCESSFUL (status) && status != SOUP_STATUS_TRY_AGAIN)
- soup_connection_disconnect (data->conn);
g_object_unref (data->conn);
g_slice_free (SoupConnectionAsyncConnectData, data);
}
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 1132479d..e37a71d5 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1513,6 +1513,7 @@ tunnel_complete (SoupConnection *conn, guint status, gpointer user_data)
soup_message_set_https_status (item->msg, item->conn);
if (!SOUP_STATUS_IS_SUCCESSFUL (status)) {
+ soup_connection_disconnect (conn);
soup_session_set_item_connection (session, item, NULL);
soup_session_set_item_status (session, item, status);
}
@@ -1597,6 +1598,7 @@ got_connection (SoupConnection *conn, guint status, gpointer user_data)
SoupSession *session = item->session;
if (status != SOUP_STATUS_OK) {
+ soup_connection_disconnect (conn);
if (item->state == SOUP_MESSAGE_CONNECTING) {
soup_session_set_item_status (session, item, status);
soup_session_set_item_connection (session, item, NULL);