[glib/tls: 9/10] tcpwrapper takes pollable stream



commit 55c973187119205e19229ec69ecd2465198c5a36
Author: Dan Winship <danw gnome org>
Date:   Thu Nov 11 14:25:06 2010 -0500

    tcpwrapper takes pollable stream

 docs/reference/gio/gio.types |    1 +
 gio/gsocketclient.c          |    5 +++--
 gio/gtcpwrapperconnection.c  |   15 ++++++++-------
 gio/gtcpwrapperconnection.h  |    2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/docs/reference/gio/gio.types b/docs/reference/gio/gio.types
index b047219..4436178 100644
--- a/docs/reference/gio/gio.types
+++ b/docs/reference/gio/gio.types
@@ -105,6 +105,7 @@ g_socket_service_get_type
 g_socket_type_get_type
 g_srv_target_get_type
 g_tcp_connection_get_type
+g_tcp_wrapper_connection_get_type
 g_themed_icon_get_type
 g_threaded_socket_service_get_type
 g_unix_connection_get_type
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index 4a1c832..30e677a 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -40,6 +40,7 @@
 #include <gio/gsocket.h>
 #include <gio/gnetworkaddress.h>
 #include <gio/gnetworkservice.h>
+#include <gio/gpollableiostream.h>
 #include <gio/gproxy.h>
 #include <gio/gsocketaddress.h>
 #include <gio/gtcpconnection.h>
@@ -732,7 +733,7 @@ g_socket_client_connect (GSocketClient       *client,
                     connection = G_SOCKET_CONNECTION (io_stream);
                   else
 		    {
-		      connection = g_tcp_wrapper_connection_new (io_stream,
+		      connection = g_tcp_wrapper_connection_new (G_POLLABLE_IO_STREAM (io_stream),
 								 socket);
 		      g_object_unref (io_stream);
 		    }
@@ -1004,7 +1005,7 @@ g_socket_client_proxy_connect_callback (GObject      *object,
         data->connection = G_SOCKET_CONNECTION (io_stream);
       else
 	{
-	  data->connection = g_tcp_wrapper_connection_new (io_stream,
+	  data->connection = g_tcp_wrapper_connection_new (G_POLLABLE_IO_STREAM (io_stream),
 							   data->current_socket);
 	  g_object_unref (io_stream);
 	}
diff --git a/gio/gtcpwrapperconnection.c b/gio/gtcpwrapperconnection.c
index 47970ad..530123f 100644
--- a/gio/gtcpwrapperconnection.c
+++ b/gio/gtcpwrapperconnection.c
@@ -27,8 +27,8 @@
  *   #GIOStream<!-- -->s that are nonetheless based on a #GSocket
  * @see_also: #GSocketConnection.
  *
- * A #GTcpWrapperConnection can be used to wrap a #GIOStream that is
- * based on a #GSocket, but which is not actually a
+ * A #GTcpWrapperConnection can be used to wrap a #GPollableIOStream
+ * that is based on a #GSocket, but which is not actually a
  * #GSocketConnection. This is used by #GSocketClient so that it can
  * always return a #GSocketConnection, even when the connection it has
  * actually created is not directly a #GSocketConnection.
@@ -40,6 +40,7 @@
 
 #include "gtcpwrapperconnection.h"
 
+#include "gpollableiostream.h"
 #include "gtcpconnection.h"
 #include "glibintl.h"
 
@@ -141,8 +142,8 @@ g_tcp_wrapper_connection_class_init (GTcpWrapperConnectionClass *klass)
                                    PROP_BASE_IO_STREAM,
                                    g_param_spec_object ("base-io-stream",
 			                                P_("Base IO Stream"),
-			                                P_("The wrapped GIOStream"),
-                                                        G_TYPE_IO_STREAM,
+			                                P_("The wrapped GPollableIOStream"),
+                                                        G_TYPE_POLLABLE_IO_STREAM,
                                                         G_PARAM_CONSTRUCT_ONLY |
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_STATIC_STRINGS));
@@ -158,7 +159,7 @@ g_tcp_wrapper_connection_init (GTcpWrapperConnection *connection)
 
 /**
  * g_tcp_wrapper_connection_new:
- * @base_io_stream: the #GIOStream to wrap
+ * @base_io_stream: the #GPollableIOStream to wrap
  * @socket: the #GSocket associated with @base_io_stream
  *
  * Wraps @base_io_stream and @socket together as a #GSocketConnection.
@@ -168,8 +169,8 @@ g_tcp_wrapper_connection_init (GTcpWrapperConnection *connection)
  * Since: 2.28
  */
 GSocketConnection *
-g_tcp_wrapper_connection_new (GIOStream *base_io_stream,
-			      GSocket   *socket)
+g_tcp_wrapper_connection_new (GPollableIOStream *base_io_stream,
+			      GSocket           *socket)
 {
   g_return_val_if_fail (G_IS_IO_STREAM (base_io_stream), NULL);
   g_return_val_if_fail (G_IS_SOCKET (socket), NULL);
diff --git a/gio/gtcpwrapperconnection.h b/gio/gtcpwrapperconnection.h
index 01d3a03..32ca259 100644
--- a/gio/gtcpwrapperconnection.h
+++ b/gio/gtcpwrapperconnection.h
@@ -59,7 +59,7 @@ struct _GTcpWrapperConnection
 
 GType              g_tcp_wrapper_connection_get_type (void) G_GNUC_CONST;
 
-GSocketConnection *g_tcp_wrapper_connection_new                (GIOStream             *base_io_stream,
+GSocketConnection *g_tcp_wrapper_connection_new                (GPollableIOStream     *base_io_stream,
 								GSocket               *socket);
 GIOStream         *g_tcp_wrapper_connection_get_base_io_stream (GTcpWrapperConnection *conn);
 



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