diff options
author | Dan Winship <danw@src.gnome.org> | 2003-12-17 19:49:14 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-12-17 19:49:14 +0000 |
commit | c2720d6770639fed2bf57a972fa7c9b47919d0ac (patch) | |
tree | d00e278329a0e3f3053f556099a3eb518a6a8c02 /libsoup/soup-connection.c | |
parent | de3cf1fc96532d10cdd1d6e55aea3c4f81501579 (diff) | |
download | libsoup-c2720d6770639fed2bf57a972fa7c9b47919d0ac.tar.gz |
Add gthread to glib check
* configure.in: Add gthread to glib check
* libsoup/soup-session.c: Make this an abstract class.
* libsoup/soup-session-async.c: A SoupSession class for
asynchronous gmain-based operation; replaces the old SoupSession.
* libsoup/soup-session-sync.c: A SoupSession class for synchronous
blocking operation for use with threaded apps.
* libsoup/soup-types.h, libsoup/soup.h: add the new session
subclasses
* libsoup/soup-connection.c (soup_connection_connect_sync): Don't
try to unref the socket if the socket creation fails.
(soup_connection_reserve): New, to explicitly mark a connection as
being in use without queueing a message on it.
* libsoup/soup-dns.c (check_hostent): Oof. Fix the logic of the
"block" flag to not be reversed.
* libsoup/soup-message.c (finished): set status to FINISHED here.
(soup_message_cancel): Gone; needs to be done at the session
level.
* libsoup/soup-message-queue.c: Add a mutex and make all of the
operations thread-safe.
* libsoup/soup-socket.c (disconnect_internal): Make this
thread-safe.
(soup_socket_connect): Make the sync case work correctly.
* libsoup/Makefile.am: add the SoupSession subclasses
* tests/Makefile.am: libsoup depends on libgthread now, so
revserver doesn't need to explicitly.
* tests/get.c, tests/auth-test.c, tests/simple-proxy.c: Use
soup_session_async_new().
Diffstat (limited to 'libsoup/soup-connection.c')
-rw-r--r-- | libsoup/soup-connection.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c index c37f813a..67bbfca3 100644 --- a/libsoup/soup-connection.c +++ b/libsoup/soup-connection.c @@ -44,6 +44,7 @@ struct SoupConnectionPrivate { SoupMessage *cur_req; time_t last_used; + gboolean in_use; }; #define PARENT_TYPE G_TYPE_OBJECT @@ -432,10 +433,14 @@ soup_connection_connect_sync (SoupConnection *conn) if (!SOUP_STATUS_IS_SUCCESSFUL (status)) { fail: - g_object_unref (conn->priv->socket); - conn->priv->socket = NULL; + if (conn->priv->socket) { + g_object_unref (conn->priv->socket); + conn->priv->socket = NULL; + } } + g_signal_emit (conn, signals[CONNECT_RESULT], 0, + proxified_status (conn, status)); return proxified_status (conn, status); } @@ -473,7 +478,7 @@ soup_connection_is_in_use (SoupConnection *conn) { g_return_val_if_fail (SOUP_IS_CONNECTION (conn), FALSE); - return conn->priv->cur_req != NULL; + return conn->priv->in_use; } /** @@ -500,6 +505,7 @@ request_done (SoupMessage *req, gpointer user_data) (gpointer *)conn->priv->cur_req); conn->priv->cur_req = NULL; conn->priv->last_used = time (NULL); + conn->priv->in_use = FALSE; g_signal_handlers_disconnect_by_func (req, request_done, conn); @@ -513,6 +519,7 @@ send_request (SoupConnection *conn, SoupMessage *req) if (req != conn->priv->cur_req) { g_return_if_fail (conn->priv->cur_req == NULL); conn->priv->cur_req = req; + conn->priv->in_use = TRUE; g_object_add_weak_pointer (G_OBJECT (req), (gpointer *)conn->priv->cur_req); @@ -536,6 +543,14 @@ soup_connection_send_request (SoupConnection *conn, SoupMessage *req) } void +soup_connection_reserve (SoupConnection *conn) +{ + g_return_if_fail (SOUP_IS_CONNECTION (conn)); + + conn->priv->in_use = TRUE; +} + +void soup_connection_authenticate (SoupConnection *conn, SoupMessage *msg, const char *auth_type, const char *auth_realm, char **username, char **password) |