Add a workaround for SSL connections which time-out but don't close the
authorJoe Shaw <joe@ximian.com>
Tue, 10 Feb 2004 22:52:15 +0000 (22:52 +0000)
committerJoe Shaw <joeshaw@src.gnome.org>
Tue, 10 Feb 2004 22:52:15 +0000 (22:52 +0000)
2004-02-10  Joe Shaw  <joe@ximian.com>

* libsoup/soup-connection.c (soup_connection_disconnect): Add a
workaround for SSL connections which time-out but don't close the
socket until we try sending data again later.

* libsoup/soup-socket.c (soup_socket_connect, soup_socket_listen):
Don't free the sockaddr from soup_address_get_sockaddr(); we don't
own it, the SoupAddress does.

ChangeLog
libsoup/soup-connection.c
libsoup/soup-socket.c

index ba6f8fa..7438367 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-02-10  Joe Shaw  <joe@ximian.com>
+
+       * libsoup/soup-connection.c (soup_connection_disconnect): Add a
+       workaround for SSL connections which time-out but don't close the
+       socket until we try sending data again later.
+
+       * libsoup/soup-socket.c (soup_socket_connect, soup_socket_listen):
+       Don't free the sockaddr from soup_address_get_sockaddr(); we don't
+       own it, the SoupAddress does.
+
 2004-02-09  JP Rosevear  <jpr@ximian.com>
 
        * configure.in: Bump libtool numbers
index d2ca402..c38cc84 100644 (file)
@@ -554,6 +554,15 @@ soup_connection_disconnect (SoupConnection *conn)
        g_object_unref (conn->priv->socket);
        conn->priv->socket = NULL;
        g_signal_emit (conn, signals[DISCONNECTED], 0);
+
+       /* Workaround for timed-out SSL connections.  Check to see if
+        * there is a message associated with this connection and that
+        * it's not the first time this connection has been used.  If met,
+        * setting the status to QUEUED will cause the connection to be
+        * restarted and the message resent.
+        */
+       if (conn->priv->cur_req && conn->priv->last_used != 0)
+               conn->priv->cur_req->status = SOUP_MESSAGE_STATUS_QUEUED;
 }
 
 /**
index ed7afbf..aa970c9 100644 (file)
@@ -453,13 +453,11 @@ soup_socket_connect (SoupSocket *sock, SoupAddress *remote_addr)
 
        sock->priv->sockfd = socket (sa->sa_family, SOCK_STREAM, 0);
        if (sock->priv->sockfd == -1) {
-               g_free (sa);
                goto done;
        }
        update_fdflags (sock);
 
        status = connect (sock->priv->sockfd, sa, len);
-       g_free (sa);
 
        if (status == -1) {
                if (errno == EINPROGRESS) {
@@ -585,8 +583,7 @@ soup_socket_listen (SoupSocket *sock, SoupAddress *local_addr)
                close (sock->priv->sockfd);
                sock->priv->sockfd = -1;
        }
-       if (sa)
-               g_free (sa);
+
        return FALSE;
 }