diff options
author | Dan Winship <danw@src.gnome.org> | 2004-07-19 19:57:46 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2004-07-19 19:57:46 +0000 |
commit | 7804c3599661849dc61dd1c4d8139f5629a68e59 (patch) | |
tree | e0612b61d437b4e158ec0cec544781b49137de15 /libsoup/soup-session-sync.c | |
parent | 86b05405598f1232077ac926d81e93378b62f377 (diff) | |
download | libsoup-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.
Diffstat (limited to 'libsoup/soup-session-sync.c')
-rw-r--r-- | libsoup/soup-session-sync.c | 28 |
1 files changed, 1 insertions, 27 deletions
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; |