From: Joe Shaw Date: Thu, 27 Feb 2003 22:12:46 +0000 (+0000) Subject: Try to apply some order to the iochannel refcounting... X-Git-Tag: LIBSOUP_1_99_15~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4c5337f38326b61e6b9436dd0b2bb59cc4254fb;p=platform%2Fupstream%2Flibsoup.git Try to apply some order to the iochannel refcounting... 2003-02-27 Joe Shaw Try to apply some order to the iochannel refcounting... * configure.in: Bump up to 1.99.11. * soup-context.c (soup_connection_get_iochannel): The connections needs to own a reference to the iochannel! If we're using HTTPS, release the ref we get from soup_socket_get_iochannel and replace it with the ref we get from soup_ssl_get_iochannel(). Then, always ref the channel that we return (ugh, but that's the soup way). (connection_free): Release the connection's ref to the iochannel. * soup-ssl.c (soup_ssl_get_iochannel_real): Ref the iochannel. The reference we pass back will be owned by the connection. (soup_ssl_hup_waitpid): Release our ref. --- diff --git a/ChangeLog b/ChangeLog index d810bba..5b62cd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2003-02-27 Joe Shaw + Try to apply some order to the iochannel refcounting... + + * configure.in: Bump up to 1.99.11. + + * soup-context.c (soup_connection_get_iochannel): The connections + needs to own a reference to the iochannel! If we're using HTTPS, + release the ref we get from soup_socket_get_iochannel and replace + it with the ref we get from soup_ssl_get_iochannel(). Then, + always ref the channel that we return (ugh, but that's the soup + way). + (connection_free): Release the connection's ref to the iochannel. + + * soup-ssl.c (soup_ssl_get_iochannel_real): Ref the iochannel. + The reference we pass back will be owned by the connection. + (soup_ssl_hup_waitpid): Release our ref. + +2003-02-27 Joe Shaw + * configure.in: Bump up to 1.99.10. * soup-ssl.c (soup_ssl_get_iochannel_real): Ref the iochannel, diff --git a/configure.in b/configure.in index c455d74..b7fd3e2 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl ******************************************* AC_INIT(libsoup/soup.h) -AM_INIT_AUTOMAKE(libsoup, 1.99.10) +AM_INIT_AUTOMAKE(libsoup, 1.99.11) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_PROG_MAKE_SET diff --git a/libsoup/soup-context.c b/libsoup/soup-context.c index 9811d4f..d834932 100644 --- a/libsoup/soup-context.c +++ b/libsoup/soup-context.c @@ -257,6 +257,7 @@ connection_free (SoupConnection *conn) conn->server->connections = g_slist_remove (conn->server->connections, conn); + g_io_channel_unref (conn->channel); soup_context_unref (conn->context); soup_socket_unref (conn->socket); g_source_remove (conn->death_tag); @@ -623,10 +624,16 @@ soup_connection_get_iochannel (SoupConnection *conn) soup_connection_setup_socket (conn->channel); - if (conn->context->uri->protocol == SOUP_PROTOCOL_HTTPS) - conn->channel = soup_ssl_get_iochannel (conn->channel); - } else - g_io_channel_ref (conn->channel); + if (conn->context->uri->protocol == SOUP_PROTOCOL_HTTPS) { + GIOChannel *ssl_chan; + + ssl_chan = soup_ssl_get_iochannel (conn->channel); + g_io_channel_unref (conn->channel); + conn->channel = ssl_chan; + } + } + + g_io_channel_ref (conn->channel); return conn->channel; } diff --git a/libsoup/soup-ssl.c b/libsoup/soup-ssl.c index 52ca4e1..6a8659a 100644 --- a/libsoup/soup-ssl.c +++ b/libsoup/soup-ssl.c @@ -49,13 +49,7 @@ soup_ssl_hup_waitpid (GIOChannel *source, GIOCondition condition, gpointer user_ waitpid (ssl_info->ppid, NULL, 0); - /* - * FIXME: The refcounting for these iochannels is totally - * broken. If we have this unref below, it causes crashes - * when using HTTPS with a proxy. Sigh. It's better to - * just leak. - */ - /* g_io_channel_unref (ssl_info->real_sock); */ + g_io_channel_unref (ssl_info->real_sock); g_free (ssl_info); return FALSE; @@ -74,7 +68,6 @@ soup_ssl_get_iochannel_real (GIOChannel *sock, SoupSSLType type) g_return_val_if_fail (sock != NULL, NULL); g_io_channel_ref (sock); - if (!(sock_fd = g_io_channel_unix_get_fd (sock))) goto ERROR_ARGS; flags = fcntl(sock_fd, F_GETFD, 0); fcntl (sock_fd, F_SETFD, flags & ~FD_CLOEXEC);