summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2004-07-19 19:57:46 +0000
committerDan Winship <danw@src.gnome.org>2004-07-19 19:57:46 +0000
commit7804c3599661849dc61dd1c4d8139f5629a68e59 (patch)
treee0612b61d437b4e158ec0cec544781b49137de15
parent86b05405598f1232077ac926d81e93378b62f377 (diff)
downloadlibsoup-7804c3599661849dc61dd1c4d8139f5629a68e59.tar.gz
Simplify this. If the message comes back from soup_connection_send_request
* libsoup/soup-session-sync.c (send_message): Simplify this. If the message comes back from soup_connection_send_request not FINISHED, get a new connection rather than reusing the old one. This fixes a race condition in which a connection could end up double-booked, and fixes the handling of messages that get redirected to another server.
-rw-r--r--ChangeLog9
-rw-r--r--libsoup/soup-session-sync.c28
2 files changed, 10 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 12c06f26..8aa425d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-07-15 Dan Winship <danw@novell.com>
+
+ * libsoup/soup-session-sync.c (send_message): Simplify this. If
+ the message comes back from soup_connection_send_request not
+ FINISHED, get a new connection rather than reusing the old one.
+ This fixes a race condition in which a connection could end up
+ double-booked, and fixes the handling of messages that get
+ redirected to another server.
+
2004-07-13 Dan Winship <danw@novell.com>
* libsoup/soup-session.c (connect_result): If the connection
diff --git a/libsoup/soup-session-sync.c b/libsoup/soup-session-sync.c
index b31dcd80..120f0165 100644
--- a/libsoup/soup-session-sync.c
+++ b/libsoup/soup-session-sync.c
@@ -146,15 +146,6 @@ wait_for_connection (SoupSession *session, SoupMessage *msg)
goto try_again;
}
-static void
-connection_disconnected (SoupConnection *conn, gpointer user_data)
-{
- SoupConnection **conn_p = user_data;
-
- g_signal_handlers_disconnect_by_func (conn, connection_disconnected, conn_p);
- *conn_p = NULL;
-}
-
static guint
send_message (SoupSession *session, SoupMessage *msg)
{
@@ -170,25 +161,8 @@ send_message (SoupSession *session, SoupMessage *msg)
if (!conn)
return msg->status_code;
- g_signal_connect (conn, "disconnected",
- G_CALLBACK (connection_disconnected), &conn);
-
- /* Now repeatedly send the message across the connection
- * until either it's done, or the connection is closed.
- */
- while (msg->status != SOUP_MESSAGE_STATUS_FINISHED && conn)
- soup_connection_send_request (conn, msg);
-
- if (conn) {
- g_signal_handlers_disconnect_by_func (conn, connection_disconnected, &conn);
- }
-
+ soup_connection_send_request (conn, msg);
g_cond_broadcast (ss->priv->cond);
-
- /* If the message isn't finished, that means we need to
- * re-send it on a new connection, so loop back to the
- * beginning.
- */
} while (msg->status != SOUP_MESSAGE_STATUS_FINISHED);
return msg->status_code;