summaryrefslogtreecommitdiff
path: root/libsoup/soup-connection.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-12-18 21:36:01 +0000
committerDan Winship <danw@src.gnome.org>2003-12-18 21:36:01 +0000
commit654248bcf1cf2fc71d7df3e21cb7c551964b8a08 (patch)
tree0483c960efe2057a25f494c00cfa093bd781a962 /libsoup/soup-connection.c
parent3e14c39c8933690ad462b16121d2718746aedb38 (diff)
downloadlibsoup-654248bcf1cf2fc71d7df3e21cb7c551964b8a08.tar.gz
Actually disconnect the socket rather than just unreffing it, since the IO
* libsoup/soup-connection.c (soup_connection_disconnect): Actually disconnect the socket rather than just unreffing it, since the IO code may be holding an extra ref on it. (send_request): connect to the "restarted" signal too (request_restarted): Deal with "Connection: close" * libsoup/soup-connection-ntlm.c (ntlm_authorize_pre): Make this not go into an infinite loop if the server only supports Basic.
Diffstat (limited to 'libsoup/soup-connection.c')
-rw-r--r--libsoup/soup-connection.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 67bbfca3..7c1535ab 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -462,6 +462,7 @@ soup_connection_disconnect (SoupConnection *conn)
g_signal_handlers_disconnect_by_func (conn->priv->socket,
socket_disconnected, conn);
+ soup_socket_disconnect (conn->priv->socket);
g_object_unref (conn->priv->socket);
conn->priv->socket = NULL;
g_signal_emit (conn, signals[DISCONNECTED], 0);
@@ -497,6 +498,13 @@ soup_connection_last_used (SoupConnection *conn)
}
static void
+request_restarted (SoupMessage *req, gpointer conn)
+{
+ if (!soup_message_is_keepalive (req))
+ soup_connection_disconnect (conn);
+}
+
+static void
request_done (SoupMessage *req, gpointer user_data)
{
SoupConnection *conn = user_data;
@@ -507,10 +515,11 @@ request_done (SoupMessage *req, gpointer user_data)
conn->priv->last_used = time (NULL);
conn->priv->in_use = FALSE;
- g_signal_handlers_disconnect_by_func (req, request_done, conn);
-
if (!soup_message_is_keepalive (req))
soup_connection_disconnect (conn);
+
+ g_signal_handlers_disconnect_by_func (req, request_done, conn);
+ g_signal_handlers_disconnect_by_func (req, request_restarted, conn);
}
static void
@@ -523,6 +532,8 @@ send_request (SoupConnection *conn, SoupMessage *req)
g_object_add_weak_pointer (G_OBJECT (req),
(gpointer *)conn->priv->cur_req);
+ g_signal_connect (req, "restarted",
+ G_CALLBACK (request_restarted), conn);
g_signal_connect (req, "finished",
G_CALLBACK (request_done), conn);
}