Merge commit 'scormi3/master'
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Mon, 10 Mar 2008 12:38:45 +0000 (09:38 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Mon, 10 Mar 2008 12:38:45 +0000 (09:38 -0300)
Conflicts:

gnio/gsocket.c
gnio/gsocket.h

12 files changed:
Makefile.am
gnio/Makefile.am
gnio/gnio.h
gnio/gnioenumtypes.c [new file with mode: 0644]
gnio/gnioenumtypes.c.template [new file with mode: 0644]
gnio/gnioenumtypes.h [new file with mode: 0644]
gnio/gnioenumtypes.h.template [new file with mode: 0644]
gnio/gsocket.c
gnio/gsocket.h
gnio/gtcpclient.c
test/test-client.c
test/test-server.c

index 008f097..da4b791 100644 (file)
@@ -5,4 +5,6 @@ SUBDIRS =    \
        test \
        $(NULL)
 
+BUILT_SOURCES = 
+
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
index 74098c3..91a72b7 100644 (file)
@@ -18,6 +18,22 @@ AM_CPPFLAGS = \
 
 lib_LTLIBRARIES=libgnio.la
 
+libgnio_la_SOURCES =        \
+       ginetaddress.c      \
+       ginet4address.c     \
+       ginet6address.c     \
+       gresolver.c         \
+       gsocketaddress.c    \
+       ginetsocketaddress.c \
+       gsocket.c \
+       gtcpserver.c \
+       gtcpclient.c \
+       gnetworkinputstream.c \
+       gnetworkoutputstream.c \
+       gasynchelper.c \
+       gnioenumtypes.c \
+        $(NULL)
+
 
 gnio_headers = \
        ginetaddress.h      \
@@ -29,28 +45,30 @@ gnio_headers =      \
        gsocket.h \
        gtcpserver.h \
        gtcpclient.h \
+       gnio.h \
+       gnioenumtypes.h \
        gnetworkinputstream.h \
        gnetworkoutputstream.h \
        $(NULL)
 
-gioincludedir=$(includedir)/glib-2.0/gnio/
-gioinclude_HEADERS =           \
-       $(gnio_headers)
+gnioincludedir=$(includedir)/gnio/
+gnioinclude_HEADERS =          \
+       $(gnio_headers) \
+       gnioenumtypes.h
 
+BUILT_SOURCES = \
+       gnioenumtypes.h \
+       gnioenumtypes.c \
+       $(NULL)
 
-libgnio_la_SOURCES =        \
-       ginetaddress.c      \
-       ginet4address.c     \
-       ginet6address.c     \
-       gresolver.c         \
-       gsocketaddress.c    \
-       ginetsocketaddress.c \
-       gsocket.c \
-       gtcpserver.c \
-       gtcpclient.c \
-       gnetworkinputstream.c \
-       gnetworkoutputstream.c \
-       gasynchelper.c \
-        $(NULL)
+gnioenumtypes.h: $(gnio_headers) gnioenumtypes.h.template
+        ( top_builddir=`cd $(top_builddir) && pwd`; \
+          cd $(srcdir) && glib-mkenums --template gnioenumtypes.h.template $(gnio_headers) ) > \
+            gnioenumtypes.h.tmp && mv gnioenumtypes.h.tmp gnioenumtypes.h
+
+gnioenumtypes.c: $(gnio_headers) gnioenumtypes.c.template
+        ( top_builddir=`cd $(top_builddir) && pwd`; \
+          cd $(srcdir) && glib-mkenums --template gnioenumtypes.c.template $(gnio_headers) ) > \
+            gnioenumtypes.c.tmp && mv gnioenumtypes.c.tmp gnioenumtypes.c
 
 
index 816459c..6eb16a6 100644 (file)
 #include <gnio/ginetaddress.h>
 #include <gnio/ginet4address.h>
 #include <gnio/ginet6address.h>
-#include <gnio/ginetsocketaddress.h>
 #include <gnio/gsocketaddress.h>
+#include <gnio/ginetsocketaddress.h>
 #include <gnio/gresolver.h>
 #include <gnio/gsocket.h>
 #include <gnio/gnioerror.h>
 #include <gnio/gtcpclient.h>
 #include <gnio/gtcpserver.h>
+#include <gnio/gnioenumtypes.h>
 
 #undef __GNIO_GNIO_H_INSIDE__
 
diff --git a/gnio/gnioenumtypes.c b/gnio/gnioenumtypes.c
new file mode 100644 (file)
index 0000000..5a31106
--- /dev/null
@@ -0,0 +1,52 @@
+
+/* Generated data (by glib-mkenums) */
+
+#include <gnio.h>
+
+/* enumerations from "gsocket.h" */
+GType
+g_socket_domain_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const GEnumValue values[] = {
+        { G_SOCKET_DOMAIN_INET, "G_SOCKET_DOMAIN_INET", "inet" },
+        { G_SOCKET_DOMAIN_INET6, "G_SOCKET_DOMAIN_INET6", "inet6" },
+        { G_SOCKET_DOMAIN_UNIX, "G_SOCKET_DOMAIN_UNIX", "unix" },
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_enum_register_static (g_intern_static_string ("GSocketDomain"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+GType
+g_socket_type_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const GEnumValue values[] = {
+        { G_SOCKET_TYPE_STREAM, "G_SOCKET_TYPE_STREAM", "stream" },
+        { G_SOCKET_TYPE_DATAGRAM, "G_SOCKET_TYPE_DATAGRAM", "datagram" },
+        { G_SOCKET_TYPE_SEQPACKET, "G_SOCKET_TYPE_SEQPACKET", "seqpacket" },
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_enum_register_static (g_intern_static_string ("GSocketType"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+#define __GNIO_ENUM_TYPES_C__
+
+/* Generated data ends here */
+
diff --git a/gnio/gnioenumtypes.c.template b/gnio/gnioenumtypes.c.template
new file mode 100644 (file)
index 0000000..30e9441
--- /dev/null
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+#include <gnio.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+#define __GNIO_ENUM_TYPES_C__
+/*** END file-tail ***/
diff --git a/gnio/gnioenumtypes.h b/gnio/gnioenumtypes.h
new file mode 100644 (file)
index 0000000..1281c64
--- /dev/null
@@ -0,0 +1,21 @@
+
+/* Generated data (by glib-mkenums) */
+
+#ifndef __GNIO_ENUM_TYPES_H__
+#define __GNIO_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "gsocket.h" */
+GType g_socket_domain_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_DOMAIN (g_socket_domain_get_type ())
+GType g_socket_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_TYPE (g_socket_type_get_type ())
+G_END_DECLS
+
+#endif /* __GNIO_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/gnio/gnioenumtypes.h.template b/gnio/gnioenumtypes.h.template
new file mode 100644 (file)
index 0000000..22c2f00
--- /dev/null
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef __GNIO_ENUM_TYPES_H__
+#define __GNIO_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define G_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __GNIO_ENUM_TYPES_H__ */
+/*** END file-tail ***/
index eb89367..c89d10b 100644 (file)
@@ -51,6 +51,9 @@ G_DEFINE_TYPE (GSocket, g_socket, G_TYPE_OBJECT);
 enum
 {
   PROP_0,
+  PROP_DOMAIN,
+  PROP_TYPE,
+  PROP_PROTOCOL,
   PROP_FD,
   PROP_BLOCKING,
   PROP_BACKLOG,
@@ -61,14 +64,108 @@ enum
 
 struct _GSocketPrivate
 {
+  GSocketDomain domain;
+  GSocketType type;
+  gchar *protocol;
   gint fd;
   gboolean blocking;
   gint backlog;
   gboolean reuse_address;
+  GError *error;
   GSocketAddress *local_address;
   GSocketAddress *remote_address;
 };
 
+static void
+g_socket_constructed (GObject *object)
+{
+  GSocket *sock = G_SOCKET (object);
+  GError *error = NULL;
+  static GStaticMutex getprotobyname_mutex = G_STATIC_MUTEX_INIT;
+  gint fd, native_domain, native_type, native_protocol;
+
+  if (sock->priv->fd >= 0)
+    {
+      // we've been constructed from an existing file descriptor
+      glong arg;
+      gboolean blocking;
+
+      // TODO: set the socket type with getsockopt (SO_TYPE)
+      // TODO: what should we do about domain and protocol?
+
+      if ((arg = fcntl (sock->priv->fd, F_GETFL, NULL)) < 0)
+        g_warning ("Error getting socket status flags: %s", g_strerror (errno));
+
+      blocking = ((arg & O_NONBLOCK) == 0);
+
+      return;
+    }
+
+  switch (sock->priv->domain)
+    {
+      case G_SOCKET_DOMAIN_INET:
+        native_domain = PF_INET;
+        break;
+
+      case G_SOCKET_DOMAIN_INET6:
+        native_domain = PF_INET6;
+        break;
+
+      case G_SOCKET_DOMAIN_UNIX:
+        native_domain = PF_UNIX;
+        break;
+
+      default:
+        g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket domain");
+        return;
+    }
+
+  switch (sock->priv->type)
+    {
+      case G_SOCKET_TYPE_STREAM:
+        native_type = SOCK_STREAM;
+        break;
+
+      case G_SOCKET_TYPE_DATAGRAM:
+        native_type = SOCK_DGRAM;
+        break;
+
+      case G_SOCKET_TYPE_SEQPACKET:
+        native_type = SOCK_SEQPACKET;
+        break;
+
+      default:
+        g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket type");
+        return;
+    }
+
+  if (sock->priv->protocol == NULL)
+    native_protocol = 0;
+  else
+    {
+      struct protoent *ent;
+      g_static_mutex_lock (&getprotobyname_mutex);
+      if (!(ent = getprotobyname (sock->priv->protocol)))
+        {
+          g_static_mutex_unlock (&getprotobyname_mutex);
+          g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket protocol");
+          return;
+        }
+      native_protocol = ent->p_proto;
+      g_static_mutex_unlock (&getprotobyname_mutex);
+    }
+
+  fd = socket (native_domain, native_type, native_protocol);
+
+  if (fd < 0)
+    {
+      g_set_error (&error, G_IO_ERROR, g_io_error_from_errno (errno), "unable to create socket: %s", g_strerror (errno));
+      return;
+    }
+
+  sock->priv->fd = fd;
+}
+
 static void
 g_socket_get_property (GObject    *object,
                        guint       prop_id,
@@ -79,6 +176,18 @@ g_socket_get_property (GObject    *object,
 
   switch (prop_id)
     {
+      case PROP_DOMAIN:
+        g_value_set_enum (value, socket->priv->domain);
+        break;
+
+      case PROP_TYPE:
+        g_value_set_enum (value, socket->priv->type);
+        break;
+
+      case PROP_PROTOCOL:
+        g_value_set_string (value, socket->priv->protocol);
+        break;
+
       case PROP_FD:
         g_value_set_int (value, socket->priv->fd);
         break;
@@ -118,6 +227,18 @@ g_socket_set_property (GObject      *object,
 
   switch (prop_id)
     {
+      case PROP_DOMAIN:
+        socket->priv->domain = g_value_get_enum (value);
+        break;
+
+      case PROP_TYPE:
+        socket->priv->type = g_value_get_enum (value);
+        break;
+
+      case PROP_PROTOCOL:
+        socket->priv->protocol = g_value_dup_string (value);
+        break;
+
       case PROP_FD:
         socket->priv->fd = g_value_get_int (value);
         break;
@@ -159,6 +280,10 @@ g_socket_dispose (GObject *object)
 {
   GSocket *socket = G_SOCKET (object);
 
+  g_free (socket->priv->protocol);
+
+  g_clear_error (&socket->priv->error);
+
   g_socket_close (socket);
 
   if (G_OBJECT_CLASS (g_socket_parent_class)->dispose)
@@ -176,9 +301,33 @@ g_socket_class_init (GSocketClass *klass)
 
   gobject_class->finalize = g_socket_finalize;
   gobject_class->dispose = g_socket_dispose;
+  gobject_class->constructed = g_socket_constructed;
   gobject_class->set_property = g_socket_set_property;
   gobject_class->get_property = g_socket_get_property;
 
+  g_object_class_install_property (gobject_class, PROP_DOMAIN,
+                                   g_param_spec_enum ("domain",
+                                                      "socket domain",
+                                                      "the socket's domain",
+                                                      G_TYPE_SOCKET_DOMAIN,
+                                                      G_SOCKET_DOMAIN_INET,
+                                                      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
+
+  g_object_class_install_property (gobject_class, PROP_TYPE,
+                                   g_param_spec_enum ("type",
+                                                      "socket type",
+                                                      "the socket's type",
+                                                      G_TYPE_SOCKET_TYPE,
+                                                      G_SOCKET_TYPE_STREAM,
+                                                      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
+
+  g_object_class_install_property (gobject_class, PROP_PROTOCOL,
+                                   g_param_spec_string ("protocol",
+                                                        "socket protocol",
+                                                        "the socket's protocol",
+                                                        NULL,
+                                                        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NICK));
+
   g_object_class_install_property (gobject_class, PROP_FD,
                                    g_param_spec_int ("fd",
                                                      "file descriptor",
@@ -234,93 +383,22 @@ g_socket_init (GSocket *socket)
   socket->priv->fd = -1;
   socket->priv->blocking = TRUE;
   socket->priv->backlog = 10;
+  socket->priv->reuse_address = FALSE;
+  socket->priv->error = NULL;
   socket->priv->remote_address = NULL;
   socket->priv->local_address = NULL;
 }
 
 GSocket *
-g_socket_new (GSocketDomain domain, GSocketType type, const gchar *protocol, GError **error)
+g_socket_new (GSocketDomain domain, GSocketType type, const gchar *protocol)
 {
-  static GStaticMutex getprotobyname_mutex = G_STATIC_MUTEX_INIT;
-  gint fd, native_domain, native_type, native_protocol;
-
-  switch (domain)
-    {
-      case G_SOCKET_DOMAIN_INET:
-        native_domain = PF_INET;
-        break;
-
-      case G_SOCKET_DOMAIN_INET6:
-        native_domain = PF_INET6;
-        break;
-
-      case G_SOCKET_DOMAIN_UNIX:
-        native_domain = PF_UNIX;
-        break;
-
-      default:
-        g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket domain");
-        return NULL;
-    }
-
-  switch (type)
-    {
-      case G_SOCKET_TYPE_STREAM:
-        native_type = SOCK_STREAM;
-        break;
-
-      case G_SOCKET_TYPE_DATAGRAM:
-        native_type = SOCK_DGRAM;
-        break;
-
-      case G_SOCKET_TYPE_SEQPACKET:
-        native_type = SOCK_SEQPACKET;
-        break;
-
-      default:
-        g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket type");
-        return NULL;
-    }
-
-  if (protocol == NULL)
-    native_protocol = 0;
-  else
-    {
-      struct protoent *ent;
-      g_static_mutex_lock (&getprotobyname_mutex);
-      if (!(ent = getprotobyname (protocol)))
-        {
-          g_static_mutex_unlock (&getprotobyname_mutex);
-          g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported socket protocol");
-          return NULL;
-        }
-      native_protocol = ent->p_proto;
-      g_static_mutex_unlock (&getprotobyname_mutex);
-    }
-
-  fd = socket(native_domain, native_type, native_protocol);
-
-  if (fd < 0)
-    {
-      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), "unable to create socket: %s", g_strerror (errno));
-      return NULL;
-    }
-
-  return G_SOCKET (g_object_new (G_TYPE_SOCKET, "fd", fd, "blocking", TRUE, NULL));
+  return G_SOCKET (g_object_new (G_TYPE_SOCKET, "domain", domain, "type", type, "protocol", protocol, NULL));
 }
 
 GSocket *
 g_socket_new_from_fd (gint fd)
 {
-  glong arg;
-  gboolean blocking;
-
-  if ((arg = fcntl (fd, F_GETFL, NULL)) < 0)
-    g_warning ("Error getting socket status flags: %s", g_strerror (errno));
-
-  blocking = ((arg & O_NONBLOCK) == 0);
-
-  return G_SOCKET (g_object_new (G_TYPE_SOCKET, "fd", fd, "blocking", blocking, NULL));
+  return G_SOCKET (g_object_new (G_TYPE_SOCKET, "fd", fd, NULL));
 }
 
 void
@@ -442,12 +520,27 @@ g_socket_get_remote_address (GSocket  *socket,
   return (socket->priv->remote_address = g_object_ref_sink (g_socket_address_from_native (buffer, len)));
 }
 
+gboolean
+g_socket_has_error (GSocket  *socket,
+                    GError  **error)
+{
+  g_return_val_if_fail (G_IS_SOCKET (socket), FALSE);
+
+  if (!socket->priv->error)
+    return FALSE;
+
+  return TRUE;
+}
+
 gboolean
 g_socket_listen (GSocket  *socket,
                  GError  **error)
 {
   g_return_val_if_fail (G_IS_SOCKET (socket), FALSE);
 
+  if (g_socket_has_error (socket, error))
+    return FALSE;
+
   if (listen (socket->priv->fd, socket->priv->backlog) < 0)
     {
       g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), "could not listen: %s", g_strerror (errno));
@@ -464,6 +557,9 @@ g_socket_bind (GSocket         *socket,
 {
   g_return_val_if_fail (G_IS_SOCKET (socket) && G_IS_SOCKET_ADDRESS (address), FALSE);
 
+  if (g_socket_has_error (socket, error))
+    return FALSE;
+
   {
     gchar addr[256];
 
@@ -490,6 +586,11 @@ g_socket_accept (GSocket       *socket,
 {
   gint ret;
 
+  g_return_val_if_fail (G_IS_SOCKET (socket), NULL);
+
+  if (g_socket_has_error (socket, error))
+    return NULL;
+
   if ((ret = accept (socket->priv->fd, NULL, 0)) < 0)
     {
       g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), "error accepting connection: %s", g_strerror (errno));
@@ -508,6 +609,9 @@ g_socket_connect (GSocket         *socket,
 
   g_return_val_if_fail (G_IS_SOCKET (socket) && G_IS_SOCKET_ADDRESS (address), FALSE);
 
+  if (g_socket_has_error (socket, error))
+    return FALSE;
+
   g_socket_address_to_native (address, buffer);
 
   if (connect (socket->priv->fd, (struct sockaddr *) buffer, g_socket_address_native_size (address)) < 0)
index ed2d4aa..72b565f 100644 (file)
@@ -72,8 +72,7 @@ GType            g_socket_get_type           (void) G_GNUC_CONST;
 
 GSocket *        g_socket_new                (GSocketDomain   domain,
                                               GSocketType     type,
-                                              const gchar    *protocol,
-                                              GError        **error);
+                                              const gchar    *protocol);
 
 GSocket *        g_socket_new_from_fd        (gint fd);
 
index fc54dc5..8978897 100644 (file)
@@ -288,16 +288,16 @@ g_tcp_client_connect (GTcpClient    *client,
     }
 
   if (G_IS_INET4_ADDRESS (address))
-    client->priv->socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL, error);
+    client->priv->socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL);
   else if (G_IS_INET6_ADDRESS (address))
-    client->priv->socket = g_socket_new (G_SOCKET_DOMAIN_INET6, G_SOCKET_TYPE_STREAM, NULL, error);
+    client->priv->socket = g_socket_new (G_SOCKET_DOMAIN_INET6, G_SOCKET_TYPE_STREAM, NULL);
   else
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "unsupported address domain");
       return FALSE;
     }
 
-  if (!client->priv->socket)
+  if (g_socket_has_error (client->priv->socket, error))
     return FALSE;
 
   if (g_cancellable_set_error_if_cancelled (cancellable, error))
index 838b7d0..901709a 100644 (file)
@@ -34,7 +34,7 @@ int main (int argc, char *argv[])
 
        loop = g_main_loop_new (NULL, FALSE);
 
-       socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL, NULL);
+       socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL);
 
        g_printf ("connecting to 127.0.0.1:31882...\n");
 
index 0b2d8ef..24ff123 100644 (file)
@@ -60,7 +60,7 @@ int main (int argc, char *argv[])
 
        loop = g_main_loop_new (NULL, FALSE);
 
-       socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL, NULL);
+       socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL);
 
        g_socket_set_reuse_address (socket, TRUE);