mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gdbusserver: Delete socket and nonce file when stopping server
Rather than when finalising it. They should be automatically recreated if the server is re-started. This is important for ensuring that all externally visible behaviour of the `GDBusServer` is synchronised with calls to g_dbus_server_{start,stop}(). Finalisation of the server object could happen an arbitrarily long time after g_dbus_server_stop() is called. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1318
This commit is contained in:
parent
61f693fb21
commit
8e32b8e87f
@ -179,6 +179,8 @@ g_dbus_server_finalize (GObject *object)
|
||||
{
|
||||
GDBusServer *server = G_DBUS_SERVER (object);
|
||||
|
||||
g_assert (!server->active);
|
||||
|
||||
if (server->authentication_observer != NULL)
|
||||
g_object_unref (server->authentication_observer);
|
||||
|
||||
@ -197,19 +199,8 @@ g_dbus_server_finalize (GObject *object)
|
||||
g_free (server->nonce);
|
||||
}
|
||||
|
||||
if (server->unix_socket_path)
|
||||
{
|
||||
if (g_unlink (server->unix_socket_path) != 0)
|
||||
g_warning ("Failed to delete %s: %s", server->unix_socket_path, g_strerror (errno));
|
||||
g_free (server->unix_socket_path);
|
||||
}
|
||||
|
||||
if (server->nonce_file)
|
||||
{
|
||||
if (g_unlink (server->nonce_file) != 0)
|
||||
g_warning ("Failed to delete %s: %s", server->nonce_file, g_strerror (errno));
|
||||
g_free (server->nonce_file);
|
||||
}
|
||||
g_free (server->unix_socket_path);
|
||||
g_free (server->nonce_file);
|
||||
|
||||
g_main_context_unref (server->main_context_at_construction);
|
||||
|
||||
@ -648,6 +639,18 @@ g_dbus_server_stop (GDBusServer *server)
|
||||
g_socket_service_stop (G_SOCKET_SERVICE (server->listener));
|
||||
server->active = FALSE;
|
||||
g_object_notify (G_OBJECT (server), "active");
|
||||
|
||||
if (server->unix_socket_path)
|
||||
{
|
||||
if (g_unlink (server->unix_socket_path) != 0)
|
||||
g_warning ("Failed to delete %s: %s", server->unix_socket_path, g_strerror (errno));
|
||||
}
|
||||
|
||||
if (server->nonce_file)
|
||||
{
|
||||
if (g_unlink (server->nonce_file) != 0)
|
||||
g_warning ("Failed to delete %s: %s", server->nonce_file, g_strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user