[glib-networking] gnutls: Expose g_tls_connection_close() internally



commit afde4488c4303f6e5e55182573bdd9c91ac28292
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Sep 26 15:22:23 2014 +0100

    gnutls: Expose g_tls_connection_close() internally
    
    This will shortly be used to implement half-duplex close().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735754

 tls/gnutls/gtlsconnection-gnutls.c |   20 +++++++++++++++-----
 tls/gnutls/gtlsconnection-gnutls.h |    4 ++++
 2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 781ca5c..8342b5f 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1609,10 +1609,10 @@ g_tls_connection_gnutls_get_output_stream (GIOStream *stream)
   return gnutls->priv->tls_ostream;
 }
 
-static gboolean
-g_tls_connection_gnutls_close (GIOStream     *stream,
-                              GCancellable  *cancellable,
-                              GError       **error)
+gboolean
+g_tls_connection_gnutls_close_internal (GIOStream     *stream,
+                                        GCancellable  *cancellable,
+                                        GError       **error)
 {
   GTlsConnectionGnutls *gnutls = G_TLS_CONNECTION_GNUTLS (stream);
   GTlsConnectionGnutlsOp op;
@@ -1652,6 +1652,15 @@ g_tls_connection_gnutls_close (GIOStream     *stream,
   return success;
 }
 
+static gboolean
+g_tls_connection_gnutls_close (GIOStream     *stream,
+                               GCancellable  *cancellable,
+                               GError       **error)
+{
+       return g_tls_connection_gnutls_close_internal (stream,
+                                                      cancellable, error);
+}
+
 /* We do async close as synchronous-in-a-thread so we don't need to
  * implement G_IO_IN/G_IO_OUT flip-flopping just for this one case
  * (since handshakes are also done synchronously now).
@@ -1665,7 +1674,8 @@ close_thread (GTask        *task,
   GIOStream *stream = object;
   GError *error = NULL;
 
-  if (!g_tls_connection_gnutls_close (stream, cancellable, &error))
+  if (!g_tls_connection_gnutls_close_internal (stream,
+                                               cancellable, &error))
     g_task_return_error (task, error);
   else
     g_task_return_boolean (task, TRUE);
diff --git a/tls/gnutls/gtlsconnection-gnutls.h b/tls/gnutls/gtlsconnection-gnutls.h
index a78469d..9cc895f 100644
--- a/tls/gnutls/gtlsconnection-gnutls.h
+++ b/tls/gnutls/gtlsconnection-gnutls.h
@@ -79,6 +79,10 @@ GSource *g_tls_connection_gnutls_create_source (GTlsConnectionGnutls  *gnutls,
                                                GIOCondition           condition,
                                                GCancellable          *cancellable);
 
+gboolean g_tls_connection_gnutls_close_internal (GIOStream            *stream,
+                                                 GCancellable         *cancellable,
+                                                 GError              **error);
+
 G_END_DECLS
 
 #endif /* __G_TLS_CONNECTION_GNUTLS_H___ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]