[glib-networking] gnutls: Update for pollable stream additions/improvements in glib
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking] gnutls: Update for pollable stream additions/improvements in glib
- Date: Tue, 24 Apr 2012 00:48:30 +0000 (UTC)
commit 78cd26ab9b4d7409a1e58230260d0333a92c156c
Author: Dan Winship <danw gnome org>
Date: Sat Mar 31 12:15:12 2012 -0400
gnutls: Update for pollable stream additions/improvements in glib
configure.ac | 5 +-
tls/gnutls/gtlsconnection-gnutls.c | 36 +++---------
tls/gnutls/gtlsinputstream-gnutls.c | 108 ----------------------------------
tls/gnutls/gtlsoutputstream-gnutls.c | 108 ----------------------------------
4 files changed, 11 insertions(+), 246 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 388259f..42d62b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ(2.65)
AC_CONFIG_MACRO_DIR([m4])
-AC_INIT([glib-networking],[2.32.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=network])
+AC_INIT([glib-networking],[2.33.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=network])
AC_CONFIG_SRCDIR([proxy/libproxy/glibproxyresolver.h])
AC_CONFIG_HEADERS([config.h])
@@ -33,7 +33,8 @@ AM_GLIB_GNU_GETTEXT
dnl *****************************
dnl *** Check GLib GIO ***
dnl *****************************
-AM_PATH_GLIB_2_0(2.31.6,,AC_MSG_ERROR(GLIB not found),gio)
+AM_PATH_GLIB_2_0(2.33.1,,AC_MSG_ERROR(GLIB not found),gio)
+GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_34"
GIO_MODULE_DIR=$($PKG_CONFIG --variable giomoduledir gio-2.0)
AS_IF([test "x$GIO_MODULE_DIR" = "x"],
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 4bed055..70440e1 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -739,20 +739,10 @@ g_tls_connection_gnutls_pull_func (gnutls_transport_ptr_t transport_data,
*/
g_clear_error (&gnutls->priv->error);
- if (gnutls->priv->blocking)
- {
- ret = g_input_stream_read (G_INPUT_STREAM (gnutls->priv->base_istream),
- buf, buflen,
- gnutls->priv->cancellable,
- &gnutls->priv->error);
- }
- else
- {
- ret = g_pollable_input_stream_read_nonblocking (gnutls->priv->base_istream,
- buf, buflen,
- gnutls->priv->cancellable,
- &gnutls->priv->error);
- }
+ ret = g_pollable_stream_read (G_INPUT_STREAM (gnutls->priv->base_istream),
+ buf, buflen, gnutls->priv->blocking,
+ gnutls->priv->cancellable,
+ &gnutls->priv->error);
if (ret < 0)
set_gnutls_error (gnutls, G_IO_IN);
@@ -775,20 +765,10 @@ g_tls_connection_gnutls_push_func (gnutls_transport_ptr_t transport_data,
/* See comment in pull_func. */
g_clear_error (&gnutls->priv->error);
- if (gnutls->priv->blocking)
- {
- ret = g_output_stream_write (G_OUTPUT_STREAM (gnutls->priv->base_ostream),
- buf, buflen,
- gnutls->priv->cancellable,
- &gnutls->priv->error);
- }
- else
- {
- ret = g_pollable_output_stream_write_nonblocking (gnutls->priv->base_ostream,
- buf, buflen,
- gnutls->priv->cancellable,
- &gnutls->priv->error);
- }
+ ret = g_pollable_stream_write (G_OUTPUT_STREAM (gnutls->priv->base_ostream),
+ buf, buflen, gnutls->priv->blocking,
+ gnutls->priv->cancellable,
+ &gnutls->priv->error);
if (ret < 0)
set_gnutls_error (gnutls, G_IO_OUT);
diff --git a/tls/gnutls/gtlsinputstream-gnutls.c b/tls/gnutls/gtlsinputstream-gnutls.c
index c081283..98a677c 100644
--- a/tls/gnutls/gtlsinputstream-gnutls.c
+++ b/tls/gnutls/gtlsinputstream-gnutls.c
@@ -68,112 +68,6 @@ g_tls_input_stream_gnutls_read (GInputStream *stream,
}
static gboolean
-g_tls_input_stream_gnutls_read_ready (GPollableInputStream *stream,
- gpointer user_data)
-{
- GTlsInputStreamGnutls *tls_stream;
- GSimpleAsyncResult *simple = user_data;
- gssize nread;
- GError *error = NULL;
-
- tls_stream = G_TLS_INPUT_STREAM_GNUTLS (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
- g_object_unref (tls_stream);
-
- nread = g_tls_connection_gnutls_read (tls_stream->priv->conn,
- tls_stream->priv->buffer,
- tls_stream->priv->count, FALSE,
- tls_stream->priv->cancellable,
- &error);
- if (nread == -1 &&
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- {
- g_error_free (error);
- return TRUE;
- }
-
- if (error)
- {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
- else
- g_simple_async_result_set_op_res_gssize (simple, nread);
-
- if (tls_stream->priv->cancellable)
- g_object_unref (tls_stream->priv->cancellable);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
-
- return FALSE;
-}
-
-static void
-g_tls_input_stream_gnutls_read_async (GInputStream *stream,
- void *buffer,
- gsize count,
- gint io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GTlsInputStreamGnutls *tls_stream = G_TLS_INPUT_STREAM_GNUTLS (stream);
- GSimpleAsyncResult *simple;
- gssize nread;
- GError *error = NULL;
- GSource *source;
-
- g_return_if_fail (tls_stream->priv->conn != NULL);
-
- simple = g_simple_async_result_new (G_OBJECT (stream), callback, user_data,
- g_tls_input_stream_gnutls_read_async);
- nread = g_tls_connection_gnutls_read (tls_stream->priv->conn,
- buffer, count, FALSE,
- cancellable, &error);
-
- if (nread >= 0 ||
- !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- {
- if (error)
- {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
- else
- g_simple_async_result_set_op_res_gssize (simple, nread);
- g_simple_async_result_complete_in_idle (simple);
- g_object_unref (simple);
- return;
- }
-
- if (error)
- g_error_free (error);
-
- tls_stream->priv->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
- tls_stream->priv->buffer = buffer;
- tls_stream->priv->count = count;
-
- source = g_tls_connection_gnutls_create_source (tls_stream->priv->conn,
- G_IO_IN,
- tls_stream->priv->cancellable);
- g_source_set_callback (source,
- (GSourceFunc) g_tls_input_stream_gnutls_read_ready,
- simple, NULL);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);
-}
-
-static gssize
-g_tls_input_stream_gnutls_read_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
-{
- g_return_val_if_fail (G_IS_TLS_INPUT_STREAM_GNUTLS (stream), -1);
- g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (stream), g_tls_input_stream_gnutls_read_async), -1);
-
- return g_simple_async_result_get_op_res_gssize (G_SIMPLE_ASYNC_RESULT (result));
-}
-
-static gboolean
g_tls_input_stream_gnutls_pollable_is_readable (GPollableInputStream *pollable)
{
GTlsInputStreamGnutls *tls_stream = G_TLS_INPUT_STREAM_GNUTLS (pollable);
@@ -220,8 +114,6 @@ g_tls_input_stream_gnutls_class_init (GTlsInputStreamGnutlsClass *klass)
gobject_class->dispose = g_tls_input_stream_gnutls_dispose;
input_stream_class->read_fn = g_tls_input_stream_gnutls_read;
- input_stream_class->read_async = g_tls_input_stream_gnutls_read_async;
- input_stream_class->read_finish = g_tls_input_stream_gnutls_read_finish;
}
static void
diff --git a/tls/gnutls/gtlsoutputstream-gnutls.c b/tls/gnutls/gtlsoutputstream-gnutls.c
index ccd5ca5..c76a2c1 100644
--- a/tls/gnutls/gtlsoutputstream-gnutls.c
+++ b/tls/gnutls/gtlsoutputstream-gnutls.c
@@ -68,112 +68,6 @@ g_tls_output_stream_gnutls_write (GOutputStream *stream,
}
static gboolean
-g_tls_output_stream_gnutls_write_ready (GIOStreamAdapter *adapter,
- gpointer user_data)
-{
- GTlsOutputStreamGnutls *tls_stream;
- GSimpleAsyncResult *simple = user_data;
- gssize nwrote;
- GError *error = NULL;
-
- tls_stream = G_TLS_OUTPUT_STREAM_GNUTLS (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
- g_object_unref (tls_stream);
-
- nwrote = g_tls_connection_gnutls_write (tls_stream->priv->conn,
- tls_stream->priv->buffer,
- tls_stream->priv->count, FALSE,
- tls_stream->priv->cancellable,
- &error);
- if (nwrote == -1 &&
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- {
- g_error_free (error);
- return TRUE;
- }
-
- if (error)
- {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
- else
- g_simple_async_result_set_op_res_gssize (simple, nwrote);
-
- if (tls_stream->priv->cancellable)
- g_object_unref (tls_stream->priv->cancellable);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
-
- return FALSE;
-}
-
-static void
-g_tls_output_stream_gnutls_write_async (GOutputStream *stream,
- const void *buffer,
- gsize count,
- gint io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GTlsOutputStreamGnutls *tls_stream = G_TLS_OUTPUT_STREAM_GNUTLS (stream);
- GSimpleAsyncResult *simple;
- gssize nwrote;
- GError *error = NULL;
- GSource *source;
-
- g_return_if_fail (tls_stream->priv->conn != NULL);
-
- simple = g_simple_async_result_new (G_OBJECT (stream), callback, user_data,
- g_tls_output_stream_gnutls_write_async);
- nwrote = g_tls_connection_gnutls_write (tls_stream->priv->conn,
- buffer, count, FALSE,
- cancellable, &error);
-
- if (nwrote >= 0 ||
- !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- {
- if (error)
- {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- }
- else
- g_simple_async_result_set_op_res_gssize (simple, nwrote);
- g_simple_async_result_complete_in_idle (simple);
- g_object_unref (simple);
- return;
- }
-
- if (error)
- g_error_free (error);
-
- tls_stream->priv->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
- tls_stream->priv->buffer = buffer;
- tls_stream->priv->count = count;
-
- source = g_tls_connection_gnutls_create_source (tls_stream->priv->conn,
- G_IO_OUT,
- tls_stream->priv->cancellable);
- g_source_set_callback (source,
- (GSourceFunc) g_tls_output_stream_gnutls_write_ready,
- simple, NULL);
- g_source_attach (source, g_main_context_get_thread_default ());
- g_source_unref (source);
-}
-
-static gssize
-g_tls_output_stream_gnutls_write_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
-{
- g_return_val_if_fail (G_IS_TLS_OUTPUT_STREAM_GNUTLS (stream), -1);
- g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (stream), g_tls_output_stream_gnutls_write_async), -1);
-
- return g_simple_async_result_get_op_res_gssize (G_SIMPLE_ASYNC_RESULT (result));
-}
-
-static gboolean
g_tls_output_stream_gnutls_pollable_is_writable (GPollableOutputStream *pollable)
{
GTlsOutputStreamGnutls *tls_stream = G_TLS_OUTPUT_STREAM_GNUTLS (pollable);
@@ -220,8 +114,6 @@ g_tls_output_stream_gnutls_class_init (GTlsOutputStreamGnutlsClass *klass)
gobject_class->dispose = g_tls_output_stream_gnutls_dispose;
output_stream_class->write_fn = g_tls_output_stream_gnutls_write;
- output_stream_class->write_async = g_tls_output_stream_gnutls_write_async;
- output_stream_class->write_finish = g_tls_output_stream_gnutls_write_finish;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]