[glib] Call sync close function directly in async implementation



commit f061765e54b81a92f4ce901016964ea4c31d77e0
Author: Alexander Larsson <alexl redhat com>
Date:   Wed May 20 11:18:34 2009 +0200

    Call sync close function directly in async implementation
    
    The g_io_stream_wrapper fails since there is already an outstanding
    operation (the async close).
---
 gio/gsocketconnection.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gio/gsocketconnection.c b/gio/gsocketconnection.c
index a1b42bb..c14e3c1 100644
--- a/gio/gsocketconnection.c
+++ b/gio/gsocketconnection.c
@@ -291,11 +291,15 @@ g_socket_connection_close_async (GIOStream        *stream,
 				 gpointer          user_data)
 {
   GSimpleAsyncResult *res;
+  GIOStreamClass *class;
   GError *error;
 
+  class = G_IO_STREAM_GET_CLASS (stream);
+
   /* socket close is not blocked, just do it! */
   error = NULL;
-  if (!g_io_stream_close (stream, cancellable, &error))
+  if (class->close_fn &&
+      !class->close_fn (stream, cancellable, &error))
     {
       g_simple_async_report_gerror_in_idle (G_OBJECT (stream),
 					    callback, user_data,



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