1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: David Zeuthen <davidz@redhat.com>
37 #include "gdbusaddress.h"
38 #include "gdbusutils.h"
39 #include "gdbusconnection.h"
40 #include "gdbusserver.h"
41 #include "gioenumtypes.h"
42 #include "gdbusprivate.h"
43 #include "gdbusauthobserver.h"
44 #include "ginitable.h"
45 #include "gsocketservice.h"
46 #include "gthreadedsocketservice.h"
47 #include "gresolver.h"
48 #include "ginetaddress.h"
49 #include "ginetsocketaddress.h"
50 #include "ginputstream.h"
51 #include "giostream.h"
54 #include "gunixsocketaddress.h"
61 * @short_description: Helper for accepting connections
64 * #GDBusServer is a helper for listening to and accepting D-Bus
65 * connections. This can be used to create a new D-Bus server, allowing two
66 * peers to use the D-Bus protocol for their own specialized communication.
67 * A server instance provided in this way will not perform message routing or
68 * implement the org.freedesktop.DBus interface.
70 * To just export an object on a well-known name on a message bus, such as the
71 * session or system bus, you should instead use g_bus_own_name().
73 * <example id="gdbus-peer-to-peer"><title>D-Bus peer-to-peer example</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-peer.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
79 * The #GDBusServer structure contains only private data and
80 * should only be accessed using the provided API.
87 GObject parent_instance;
89 GDBusServerFlags flags;
96 gchar *client_address;
98 GSocketListener *listener;
99 gboolean is_using_listener;
100 gulong run_signal_handler_id;
102 /* The result of g_main_context_get_thread_default() when the object
103 * was created (the GObject _init() function) - this is used for delivery
104 * of the :new-connection GObject signal.
106 GMainContext *main_context_at_construction;
110 GDBusAuthObserver *authentication_observer;
113 typedef struct _GDBusServerClass GDBusServerClass;
117 * @new_connection: Signal class handler for the #GDBusServer::new-connection signal.
119 * Class structure for #GDBusServer.
123 struct _GDBusServerClass
126 GObjectClass parent_class;
130 gboolean (*new_connection) (GDBusServer *server,
131 GDBusConnection *connection);
142 PROP_AUTHENTICATION_OBSERVER,
147 NEW_CONNECTION_SIGNAL,
151 guint _signals[LAST_SIGNAL] = {0};
153 static void initable_iface_init (GInitableIface *initable_iface);
155 G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT,
156 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
160 g_dbus_server_finalize (GObject *object)
162 GDBusServer *server = G_DBUS_SERVER (object);
164 if (server->authentication_observer != NULL)
165 g_object_unref (server->authentication_observer);
167 if (server->run_signal_handler_id > 0)
168 g_signal_handler_disconnect (server->listener, server->run_signal_handler_id);
170 if (server->listener != NULL)
171 g_object_unref (server->listener);
173 g_free (server->address);
174 g_free (server->guid);
175 g_free (server->client_address);
176 if (server->nonce != NULL)
178 memset (server->nonce, '\0', 16);
179 g_free (server->nonce);
181 /* we could unlink the nonce file but I don't
182 * think it's really worth the effort/risk
184 g_free (server->nonce_file);
186 if (server->main_context_at_construction != NULL)
187 g_main_context_unref (server->main_context_at_construction);
189 G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize (object);
193 g_dbus_server_get_property (GObject *object,
198 GDBusServer *server = G_DBUS_SERVER (object);
203 g_value_set_flags (value, server->flags);
207 g_value_set_string (value, server->guid);
211 g_value_set_string (value, server->address);
214 case PROP_CLIENT_ADDRESS:
215 g_value_set_string (value, server->client_address);
219 g_value_set_boolean (value, server->active);
222 case PROP_AUTHENTICATION_OBSERVER:
223 g_value_set_object (value, server->authentication_observer);
227 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
233 g_dbus_server_set_property (GObject *object,
238 GDBusServer *server = G_DBUS_SERVER (object);
243 server->flags = g_value_get_flags (value);
247 server->guid = g_value_dup_string (value);
251 server->address = g_value_dup_string (value);
254 case PROP_AUTHENTICATION_OBSERVER:
255 server->authentication_observer = g_value_dup_object (value);
259 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
265 g_dbus_server_class_init (GDBusServerClass *klass)
267 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
269 gobject_class->finalize = g_dbus_server_finalize;
270 gobject_class->set_property = g_dbus_server_set_property;
271 gobject_class->get_property = g_dbus_server_get_property;
276 * Flags from the #GDBusServerFlags enumeration.
280 g_object_class_install_property (gobject_class,
282 g_param_spec_flags ("flags",
284 P_("Flags for the server"),
285 G_TYPE_DBUS_SERVER_FLAGS,
286 G_DBUS_SERVER_FLAGS_NONE,
289 G_PARAM_CONSTRUCT_ONLY |
290 G_PARAM_STATIC_NAME |
291 G_PARAM_STATIC_BLURB |
292 G_PARAM_STATIC_NICK));
297 * The guid of the server.
301 g_object_class_install_property (gobject_class,
303 g_param_spec_string ("guid",
305 P_("The guid of the server"),
309 G_PARAM_CONSTRUCT_ONLY |
310 G_PARAM_STATIC_NAME |
311 G_PARAM_STATIC_BLURB |
312 G_PARAM_STATIC_NICK));
315 * GDBusServer:address:
317 * The D-Bus address to listen on.
321 g_object_class_install_property (gobject_class,
323 g_param_spec_string ("address",
325 P_("The address to listen on"),
329 G_PARAM_CONSTRUCT_ONLY |
330 G_PARAM_STATIC_NAME |
331 G_PARAM_STATIC_BLURB |
332 G_PARAM_STATIC_NICK));
335 * GDBusServer:client-address:
337 * The D-Bus address that clients can use.
341 g_object_class_install_property (gobject_class,
343 g_param_spec_string ("client-address",
344 P_("Client Address"),
345 P_("The address clients can use"),
348 G_PARAM_STATIC_NAME |
349 G_PARAM_STATIC_BLURB |
350 G_PARAM_STATIC_NICK));
353 * GDBusServer:active:
355 * Whether the server is currently active.
359 g_object_class_install_property (gobject_class,
361 g_param_spec_boolean ("active",
363 P_("Whether the server is currently active"),
366 G_PARAM_STATIC_NAME |
367 G_PARAM_STATIC_BLURB |
368 G_PARAM_STATIC_NICK));
371 * GDBusServer:authentication-observer:
373 * A #GDBusAuthObserver object to assist in the authentication process or %NULL.
377 g_object_class_install_property (gobject_class,
378 PROP_AUTHENTICATION_OBSERVER,
379 g_param_spec_object ("authentication-observer",
380 P_("Authentication Observer"),
381 P_("Object used to assist in the authentication process"),
382 G_TYPE_DBUS_AUTH_OBSERVER,
385 G_PARAM_CONSTRUCT_ONLY |
386 G_PARAM_STATIC_NAME |
387 G_PARAM_STATIC_BLURB |
388 G_PARAM_STATIC_NICK));
391 * GDBusServer::new-connection:
392 * @server: The #GDBusServer emitting the signal.
393 * @connection: A #GDBusConnection for the new connection.
395 * Emitted when a new authenticated connection has been made. Use
396 * g_dbus_connection_get_peer_credentials() to figure out what
397 * identity (if any), was authenticated.
399 * If you want to accept the connection, take a reference to the
400 * @connection object and return %TRUE. When you are done with the
401 * connection call g_dbus_connection_close() and give up your
402 * reference. Note that the other peer may disconnect at any time -
403 * a typical thing to do when accepting a connection is to listen to
404 * the #GDBusConnection::closed signal.
406 * If #GDBusServer:flags contains %G_DBUS_SERVER_FLAGS_RUN_IN_THREAD
407 * then the signal is emitted in a new thread dedicated to the
408 * connection. Otherwise the signal is emitted in the <link
409 * linkend="g-main-context-push-thread-default">thread-default main
410 * loop</link> of the thread that @server was constructed in.
412 * You are guaranteed that signal handlers for this signal runs
413 * before incoming messages on @connection are processed. This means
414 * that it's suitable to call g_dbus_connection_register_object() or
415 * similar from the signal handler.
417 * Returns: %TRUE to claim @connection, %FALSE to let other handlers
422 _signals[NEW_CONNECTION_SIGNAL] = g_signal_new ("new-connection",
425 G_STRUCT_OFFSET (GDBusServerClass, new_connection),
426 g_signal_accumulator_true_handled,
427 NULL, /* accu_data */
431 G_TYPE_DBUS_CONNECTION);
435 g_dbus_server_init (GDBusServer *server)
437 server->main_context_at_construction = g_main_context_get_thread_default ();
438 if (server->main_context_at_construction != NULL)
439 g_main_context_ref (server->main_context_at_construction);
443 on_run (GSocketService *service,
444 GSocketConnection *socket_connection,
445 GObject *source_object,
449 * g_dbus_server_new_sync:
450 * @address: A D-Bus address.
451 * @flags: Flags from the #GDBusServerFlags enumeration.
452 * @guid: A D-Bus GUID.
453 * @observer: A #GDBusAuthObserver or %NULL.
454 * @cancellable: A #GCancellable or %NULL.
455 * @error: Return location for server or %NULL.
457 * Creates a new D-Bus server that listens on the first address in
458 * @address that works.
460 * Once constructed, you can use g_dbus_server_get_client_address() to
461 * get a D-Bus address string that clients can use to connect.
463 * Connect to the #GDBusServer::new-connection signal to handle
464 * incoming connections.
466 * The returned #GDBusServer isn't active - you have to start it with
467 * g_dbus_server_start().
469 * See <xref linkend="gdbus-peer-to-peer"/> for how #GDBusServer can
472 * This is a synchronous failable constructor. See
473 * g_dbus_server_new() for the asynchronous version.
475 * Returns: A #GDBusServer or %NULL if @error is set. Free with
481 g_dbus_server_new_sync (const gchar *address,
482 GDBusServerFlags flags,
484 GDBusAuthObserver *observer,
485 GCancellable *cancellable,
490 g_return_val_if_fail (address != NULL, NULL);
491 g_return_val_if_fail (g_dbus_is_guid (guid), NULL);
492 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
494 server = g_initable_new (G_TYPE_DBUS_SERVER,
500 "authentication-observer", observer,
507 * g_dbus_server_get_client_address:
508 * @server: A #GDBusServer.
510 * Gets a D-Bus address string that can be used by clients to connect
513 * Returns: A D-Bus address string. Do not free, the string is owned
519 g_dbus_server_get_client_address (GDBusServer *server)
521 g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
522 return server->client_address;
526 * g_dbus_server_get_guid:
527 * @server: A #GDBusServer.
529 * Gets the GUID for @server.
531 * Returns: A D-Bus GUID. Do not free this string, it is owned by @server.
536 g_dbus_server_get_guid (GDBusServer *server)
538 g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
543 * g_dbus_server_get_flags:
544 * @server: A #GDBusServer.
546 * Gets the flags for @server.
548 * Returns: A set of flags from the #GDBusServerFlags enumeration.
553 g_dbus_server_get_flags (GDBusServer *server)
555 g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
556 return server->flags;
560 * g_dbus_server_is_active:
561 * @server: A #GDBusServer.
563 * Gets whether @server is active.
565 * Returns: %TRUE if server is active, %FALSE otherwise.
570 g_dbus_server_is_active (GDBusServer *server)
572 g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
573 return server->active;
577 * g_dbus_server_start:
578 * @server: A #GDBusServer.
585 g_dbus_server_start (GDBusServer *server)
587 g_return_if_fail (G_IS_DBUS_SERVER (server));
590 /* Right now we don't have any transport not using the listener... */
591 g_assert (server->is_using_listener);
592 g_socket_service_start (G_SOCKET_SERVICE (server->listener));
593 server->active = TRUE;
594 g_object_notify (G_OBJECT (server), "active");
598 * g_dbus_server_stop:
599 * @server: A #GDBusServer.
606 g_dbus_server_stop (GDBusServer *server)
608 g_return_if_fail (G_IS_DBUS_SERVER (server));
611 /* Right now we don't have any transport not using the listener... */
612 g_assert (server->is_using_listener);
613 g_assert (server->run_signal_handler_id > 0);
614 g_signal_handler_disconnect (server->listener, server->run_signal_handler_id);
615 server->run_signal_handler_id = 0;
616 g_socket_service_stop (G_SOCKET_SERVICE (server->listener));
617 server->active = FALSE;
618 g_object_notify (G_OBJECT (server), "active");
621 /* ---------------------------------------------------------------------------------------------------- */
629 ret = g_random_int_range (0, 60);
639 /* note that address_entry has already been validated => exactly one of path, tmpdir or abstract keys are set */
641 try_unix (GDBusServer *server,
642 const gchar *address_entry,
643 GHashTable *key_value_pairs,
649 const gchar *abstract;
650 GSocketAddress *address;
655 path = g_hash_table_lookup (key_value_pairs, "path");
656 tmpdir = g_hash_table_lookup (key_value_pairs, "tmpdir");
657 abstract = g_hash_table_lookup (key_value_pairs, "abstract");
661 address = g_unix_socket_address_new (path);
663 else if (tmpdir != NULL)
670 s = g_string_new (tmpdir);
671 g_string_append (s, "/dbus-");
672 for (n = 0; n < 8; n++)
673 g_string_append_c (s, random_ascii ());
675 /* prefer abstract namespace if available */
676 if (g_unix_socket_address_abstract_names_supported ())
677 address = g_unix_socket_address_new_with_type (s->str,
679 G_UNIX_SOCKET_ADDRESS_ABSTRACT);
681 address = g_unix_socket_address_new (s->str);
682 g_string_free (s, TRUE);
685 if (!g_socket_listener_add_address (server->listener,
687 G_SOCKET_TYPE_STREAM,
688 G_SOCKET_PROTOCOL_DEFAULT,
689 NULL, /* source_object */
690 NULL, /* effective_address */
693 if (local_error->domain == G_IO_ERROR && local_error->code == G_IO_ERROR_ADDRESS_IN_USE)
695 g_error_free (local_error);
698 g_propagate_error (error, local_error);
704 else if (abstract != NULL)
706 if (!g_unix_socket_address_abstract_names_supported ())
708 g_set_error_literal (error,
710 G_IO_ERROR_NOT_SUPPORTED,
711 _("Abstract name space not supported"));
714 address = g_unix_socket_address_new_with_type (abstract,
716 G_UNIX_SOCKET_ADDRESS_ABSTRACT);
720 g_assert_not_reached ();
723 if (!g_socket_listener_add_address (server->listener,
725 G_SOCKET_TYPE_STREAM,
726 G_SOCKET_PROTOCOL_DEFAULT,
727 NULL, /* source_object */
728 NULL, /* effective_address */
738 /* Fill out client_address if the connection attempt worked */
741 server->is_using_listener = TRUE;
743 switch (g_unix_socket_address_get_address_type (G_UNIX_SOCKET_ADDRESS (address)))
745 case G_UNIX_SOCKET_ADDRESS_ABSTRACT:
746 server->client_address = g_strdup_printf ("unix:abstract=%s",
747 g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
750 case G_UNIX_SOCKET_ADDRESS_PATH:
751 server->client_address = g_strdup_printf ("unix:path=%s",
752 g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
756 g_assert_not_reached ();
760 g_object_unref (address);
766 /* ---------------------------------------------------------------------------------------------------- */
768 /* note that address_entry has already been validated =>
769 * both host and port (guranteed to be a number in [0, 65535]) are set (family is optional)
772 try_tcp (GDBusServer *server,
773 const gchar *address_entry,
774 GHashTable *key_value_pairs,
783 GList *resolved_addresses;
788 resolved_addresses = NULL;
790 host = g_hash_table_lookup (key_value_pairs, "host");
791 port = g_hash_table_lookup (key_value_pairs, "port");
792 /* family = g_hash_table_lookup (key_value_pairs, "family"); */
793 if (g_hash_table_lookup (key_value_pairs, "noncefile") != NULL)
795 g_set_error_literal (error,
797 G_IO_ERROR_INVALID_ARGUMENT,
798 _("Cannot specify nonce file when creating a server"));
806 port_num = strtol (port, NULL, 10);
808 resolver = g_resolver_get_default ();
809 resolved_addresses = g_resolver_lookup_by_name (resolver,
813 if (resolved_addresses == NULL)
816 /* TODO: handle family */
817 for (l = resolved_addresses; l != NULL; l = l->next)
819 GInetAddress *address = G_INET_ADDRESS (l->data);
820 GSocketAddress *socket_address;
821 GSocketAddress *effective_address;
823 socket_address = g_inet_socket_address_new (address, port_num);
824 if (!g_socket_listener_add_address (server->listener,
826 G_SOCKET_TYPE_STREAM,
827 G_SOCKET_PROTOCOL_TCP,
828 NULL, /* GObject *source_object */
832 g_object_unref (socket_address);
836 /* make sure we allocate the same port number for other listeners */
837 port_num = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (effective_address));
839 g_object_unref (effective_address);
840 g_object_unref (socket_address);
848 gsize bytes_remaining;
850 server->nonce = g_new0 (guchar, 16);
851 for (n = 0; n < 16; n++)
852 server->nonce[n] = g_random_int_range (0, 256);
853 fd = g_file_open_tmp ("gdbus-nonce-file-XXXXXX",
858 g_socket_listener_close (server->listener);
863 bytes_remaining = 16;
864 while (bytes_remaining > 0)
867 ret = write (fd, server->nonce + bytes_written, bytes_remaining);
874 g_io_error_from_errno (errno),
875 _("Error writing nonce file at `%s': %s"),
880 bytes_written += ret;
881 bytes_remaining -= ret;
884 server->client_address = g_strdup_printf ("nonce-tcp:host=%s,port=%d,noncefile=%s",
891 server->client_address = g_strdup_printf ("tcp:host=%s,port=%d", host, port_num);
893 server->is_using_listener = TRUE;
897 g_list_foreach (resolved_addresses, (GFunc) g_object_unref, NULL);
898 g_list_free (resolved_addresses);
899 g_object_unref (resolver);
903 /* ---------------------------------------------------------------------------------------------------- */
908 GDBusConnection *connection;
912 emit_idle_data_free (EmitIdleData *data)
914 g_object_unref (data->server);
915 g_object_unref (data->connection);
920 emit_new_connection_in_idle (gpointer user_data)
922 EmitIdleData *data = user_data;
926 g_signal_emit (data->server,
927 _signals[NEW_CONNECTION_SIGNAL],
933 g_dbus_connection_start_message_processing (data->connection);
934 g_object_unref (data->connection);
939 /* Called in new thread */
941 on_run (GSocketService *service,
942 GSocketConnection *socket_connection,
943 GObject *source_object,
946 GDBusServer *server = G_DBUS_SERVER (user_data);
947 GDBusConnection *connection;
948 GDBusConnectionFlags connection_flags;
950 if (server->nonce != NULL)
955 if (!g_input_stream_read_all (g_io_stream_get_input_stream (G_IO_STREAM (socket_connection)),
959 NULL, /* GCancellable */
963 if (bytes_read != 16)
966 if (memcmp (buf, server->nonce, 16) != 0)
971 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
972 G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING;
973 if (server->flags & G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS)
974 connection_flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
976 connection = g_dbus_connection_new_sync (G_IO_STREAM (socket_connection),
979 server->authentication_observer,
980 NULL, /* GCancellable */
982 if (connection == NULL)
985 if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
990 g_signal_emit (server,
991 _signals[NEW_CONNECTION_SIGNAL],
996 g_dbus_connection_start_message_processing (connection);
997 g_object_unref (connection);
1001 GSource *idle_source;
1004 data = g_new0 (EmitIdleData, 1);
1005 data->server = g_object_ref (server);
1006 data->connection = g_object_ref (connection);
1008 idle_source = g_idle_source_new ();
1009 g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
1010 g_source_set_callback (idle_source,
1011 emit_new_connection_in_idle,
1013 (GDestroyNotify) emit_idle_data_free);
1014 g_source_attach (idle_source, server->main_context_at_construction);
1015 g_source_unref (idle_source);
1023 initable_init (GInitable *initable,
1024 GCancellable *cancellable,
1027 GDBusServer *server = G_DBUS_SERVER (initable);
1037 if (!g_dbus_is_guid (server->guid))
1039 g_set_error (&last_error,
1041 G_IO_ERROR_INVALID_ARGUMENT,
1042 _("The string `%s' is not a valid D-Bus GUID"),
1047 server->listener = G_SOCKET_LISTENER (g_threaded_socket_service_new (-1));
1049 addr_array = g_strsplit (server->address, ";", 0);
1051 for (n = 0; addr_array != NULL && addr_array[n] != NULL; n++)
1053 const gchar *address_entry = addr_array[n];
1054 GHashTable *key_value_pairs;
1055 gchar *transport_name;
1059 if (g_dbus_is_supported_address (address_entry,
1061 _g_dbus_address_parse_entry (address_entry,
1071 else if (g_strcmp0 (transport_name, "unix") == 0)
1072 ret = try_unix (server, address_entry, key_value_pairs, &this_error);
1074 else if (g_strcmp0 (transport_name, "tcp") == 0)
1075 ret = try_tcp (server, address_entry, key_value_pairs, FALSE, &this_error);
1076 else if (g_strcmp0 (transport_name, "nonce-tcp") == 0)
1077 ret = try_tcp (server, address_entry, key_value_pairs, TRUE, &this_error);
1079 g_set_error (&this_error,
1081 G_IO_ERROR_INVALID_ARGUMENT,
1082 _("Cannot listen on unsupported transport `%s'"),
1085 g_free (transport_name);
1086 if (key_value_pairs != NULL)
1087 g_hash_table_unref (key_value_pairs);
1091 g_assert (this_error == NULL);
1096 if (this_error != NULL)
1098 if (last_error != NULL)
1099 g_error_free (last_error);
1100 last_error = this_error;
1106 g_strfreev (addr_array);
1110 if (last_error != NULL)
1111 g_error_free (last_error);
1113 /* Right now we don't have any transport not using the listener... */
1114 g_assert (server->is_using_listener);
1115 server->run_signal_handler_id = g_signal_connect (G_SOCKET_SERVICE (server->listener),
1117 G_CALLBACK (on_run),
1122 g_assert (last_error != NULL);
1123 g_propagate_error (error, last_error);
1130 initable_iface_init (GInitableIface *initable_iface)
1132 initable_iface->init = initable_init;
1135 /* ---------------------------------------------------------------------------------------------------- */