remove client object

Remove the client object, it is not very useful now that we have the
nodes.
Fix some properties on the proxy objects.
Use sendmsg and recvmsg directly because the GIO ones do allocations.
make pinos_properties_merge and use it to combine properties from nodes
and ports.
This commit is contained in:
Wim Taymans 2016-05-18 17:22:34 +02:00
parent 60475165d6
commit 5f10a933a1
22 changed files with 298 additions and 1030 deletions

View file

@ -1,432 +0,0 @@
/* Pinos
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include "pinos/client/pinos.h"
#include "pinos/server/client.h"
#include "pinos/server/server-node.h"
#include "pinos/server/upload-node.h"
#include "pinos/dbus/org-pinos.h"
struct _PinosClientPrivate
{
PinosDaemon *daemon;
PinosClient1 *iface;
gchar *sender;
gchar *object_path;
PinosProperties *properties;
PinosFdManager *fdmanager;
GList *nodes;
};
#define PINOS_CLIENT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), PINOS_TYPE_CLIENT, PinosClientPrivate))
G_DEFINE_TYPE (PinosClient, pinos_client, G_TYPE_OBJECT);
enum
{
PROP_0,
PROP_DAEMON,
PROP_SENDER,
PROP_OBJECT_PATH,
PROP_PROPERTIES,
};
enum
{
SIGNAL_DISCONNECT,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void
pinos_client_get_property (GObject *_object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PinosClient *client = PINOS_CLIENT (_object);
PinosClientPrivate *priv = client->priv;
switch (prop_id) {
case PROP_DAEMON:
g_value_set_object (value, priv->daemon);
break;
case PROP_SENDER:
g_value_set_string (value, priv->sender);
break;
case PROP_OBJECT_PATH:
g_value_set_string (value, priv->object_path);
break;
case PROP_PROPERTIES:
g_value_set_boxed (value, priv->properties);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (client, prop_id, pspec);
break;
}
}
static void
pinos_client_set_property (GObject *_object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PinosClient *client = PINOS_CLIENT (_object);
PinosClientPrivate *priv = client->priv;
switch (prop_id) {
case PROP_DAEMON:
priv->daemon = g_value_dup_object (value);
break;
case PROP_SENDER:
priv->sender = g_value_dup_string (value);
pinos_client1_set_sender (priv->iface, priv->sender);
break;
case PROP_PROPERTIES:
if (priv->properties)
pinos_properties_free (priv->properties);
priv->properties = g_value_dup_boxed (value);
pinos_client1_set_properties (priv->iface, priv->properties ?
pinos_properties_to_variant (priv->properties) : NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (client, prop_id, pspec);
break;
}
}
static void
handle_remove_node (PinosNode *node,
gpointer user_data)
{
PinosClient *client = user_data;
PinosClientPrivate *priv = client->priv;
g_debug ("client %p: remove node %p", client, node);
priv->nodes = g_list_remove (priv->nodes, node);
g_object_unref (node);
}
static gboolean
handle_create_node (PinosClient1 *interface,
GDBusMethodInvocation *invocation,
const gchar *arg_name,
GVariant *arg_properties,
gpointer user_data)
{
PinosClient *client = user_data;
PinosClientPrivate *priv = client->priv;
PinosNode *node;
const gchar *object_path, *sender;
PinosProperties *props;
sender = g_dbus_method_invocation_get_sender (invocation);
if (g_strcmp0 (pinos_client_get_sender (client), sender) != 0)
goto not_allowed;
props = pinos_properties_from_variant (arg_properties);
node = pinos_server_node_new (priv->daemon,
sender,
arg_name,
props);
pinos_properties_free (props);
if (node == NULL)
goto no_node;
priv->nodes = g_list_prepend (priv->nodes, node);
g_signal_connect (node,
"remove",
(GCallback) handle_remove_node,
client);
object_path = pinos_server_node_get_object_path (PINOS_SERVER_NODE (node));
g_debug ("client %p: add node %p %d, %s", client, node, G_OBJECT (node)->ref_count, object_path);
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("(o)", object_path));
return TRUE;
/* ERRORS */
not_allowed:
{
g_debug ("sender %s is not owner of client object %s", sender, pinos_client_get_sender (client));
g_dbus_method_invocation_return_dbus_error (invocation,
"org.pinos.Error", "sender not client owner");
return TRUE;
}
no_node:
{
g_debug ("client %p: could create node %s", client, arg_name);
g_dbus_method_invocation_return_dbus_error (invocation,
"org.pinos.Error", "can't create node");
pinos_properties_free (props);
return TRUE;
}
}
static gboolean
handle_disconnect (PinosClient1 *interface,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
PinosClient *client = user_data;
g_debug ("client %p: disconnect", client);
g_signal_emit (client, signals[SIGNAL_DISCONNECT], 0, NULL);
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("()"));
return TRUE;
}
static void
client_register_object (PinosClient *client)
{
PinosClientPrivate *priv = client->priv;
PinosDaemon *daemon = priv->daemon;
PinosObjectSkeleton *skel;
skel = pinos_object_skeleton_new (PINOS_DBUS_OBJECT_CLIENT);
pinos_object_skeleton_set_client1 (skel, priv->iface);
g_free (priv->object_path);
priv->object_path = pinos_daemon_export_uniquely (daemon, G_DBUS_OBJECT_SKELETON (skel));
g_object_unref (skel);
g_debug ("client %p: register %s", client, priv->object_path);
}
static void
client_unregister_object (PinosClient *client)
{
PinosClientPrivate *priv = client->priv;
PinosDaemon *daemon = priv->daemon;
g_debug ("client %p: unregister", client);
pinos_daemon_unexport (daemon, priv->object_path);
}
static void
pinos_client_dispose (GObject * object)
{
PinosClient *client = PINOS_CLIENT (object);
PinosClientPrivate *priv = client->priv;
GList *copy;
g_debug ("client %p: dispose", client);
pinos_fd_manager_remove_all (priv->fdmanager, priv->object_path);
copy = g_list_copy (priv->nodes);
g_list_free_full (copy, (GDestroyNotify) pinos_node_remove);
client_unregister_object (client);
G_OBJECT_CLASS (pinos_client_parent_class)->dispose (object);
}
static void
pinos_client_finalize (GObject * object)
{
PinosClient *client = PINOS_CLIENT (object);
PinosClientPrivate *priv = client->priv;
g_debug ("client %p: finalize", client);
g_clear_object (&priv->daemon);
g_clear_object (&priv->iface);
g_free (priv->sender);
g_free (priv->object_path);
if (priv->properties)
pinos_properties_free (priv->properties);
g_clear_object (&priv->fdmanager);
G_OBJECT_CLASS (pinos_client_parent_class)->finalize (object);
}
static void
pinos_client_constructed (GObject * object)
{
PinosClient *client = PINOS_CLIENT (object);
g_debug ("client %p: constructed", client);
client_register_object (client);
G_OBJECT_CLASS (pinos_client_parent_class)->constructed (object);
}
static void
pinos_client_class_init (PinosClientClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (PinosClientPrivate));
gobject_class->constructed = pinos_client_constructed;
gobject_class->dispose = pinos_client_dispose;
gobject_class->finalize = pinos_client_finalize;
gobject_class->set_property = pinos_client_set_property;
gobject_class->get_property = pinos_client_get_property;
g_object_class_install_property (gobject_class,
PROP_DAEMON,
g_param_spec_object ("daemon",
"Daemon",
"The daemon",
PINOS_TYPE_DAEMON,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SENDER,
g_param_spec_string ("sender",
"Sender",
"The sender",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_OBJECT_PATH,
g_param_spec_string ("object-path",
"Object Path",
"The object path",
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_PROPERTIES,
g_param_spec_boxed ("properties",
"Properties",
"Client properties",
PINOS_TYPE_PROPERTIES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
signals[SIGNAL_DISCONNECT] = g_signal_new ("disconnect",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL,
NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
0,
G_TYPE_NONE);
}
static void
pinos_client_init (PinosClient * client)
{
PinosClientPrivate *priv = client->priv = PINOS_CLIENT_GET_PRIVATE (client);
priv->iface = pinos_client1_skeleton_new ();
g_signal_connect (priv->iface, "handle-create-node",
(GCallback) handle_create_node,
client);
g_signal_connect (priv->iface, "handle-disconnect",
(GCallback) handle_disconnect,
client);
g_debug ("client %p: new", client);
priv->fdmanager = pinos_fd_manager_get (PINOS_FD_MANAGER_DEFAULT);
}
/**
* pinos_client_new:
* @daemon: a #PinosDaemon
* @sender: the sender id
* @prefix: a prefix
* @properties: extra client properties
*
* Make a new #PinosClient object and register it to @daemon under the @prefix.
*
* Returns: a new #PinosClient
*/
PinosClient *
pinos_client_new (PinosDaemon *daemon,
const gchar *sender,
PinosProperties *properties)
{
g_return_val_if_fail (PINOS_IS_DAEMON (daemon), NULL);
return g_object_new (PINOS_TYPE_CLIENT, "daemon", daemon,
"sender", sender,
"properties", properties,
NULL);
}
/**
* pinos_client_get_sender:
* @client: a #PinosClient
*
* Get the sender of @client.
*
* Returns: the sender of @client
*/
const gchar *
pinos_client_get_sender (PinosClient *client)
{
PinosClientPrivate *priv;
g_return_val_if_fail (PINOS_IS_CLIENT (client), NULL);
priv = client->priv;
return priv->sender;
}
/**
* pinos_client_get_object_path:
* @client: a #PinosClient
*
* Get the object path of @client.
*
* Returns: the object path of @client
*/
const gchar *
pinos_client_get_object_path (PinosClient *client)
{
PinosClientPrivate *priv;
g_return_val_if_fail (PINOS_IS_CLIENT (client), NULL);
priv = client->priv;
return priv->object_path;
}

View file

@ -1,74 +0,0 @@
/* Pinos
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PINOS_CLIENT_H__
#define __PINOS_CLIENT_H__
#include <glib-object.h>
#include <pinos/server/daemon.h>
G_BEGIN_DECLS
#define PINOS_TYPE_CLIENT (pinos_client_get_type ())
#define PINOS_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PINOS_TYPE_CLIENT))
#define PINOS_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PINOS_TYPE_CLIENT))
#define PINOS_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PINOS_TYPE_CLIENT, PinosClientClass))
#define PINOS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PINOS_TYPE_CLIENT, PinosClient))
#define PINOS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PINOS_TYPE_CLIENT, PinosClientClass))
#define PINOS_CLIENT_CAST(obj) ((PinosClient*)(obj))
#define PINOS_CLIENT_CLASS_CAST(klass) ((PinosClientClass*)(klass))
typedef struct _PinosClient PinosClient;
typedef struct _PinosClientClass PinosClientClass;
typedef struct _PinosClientPrivate PinosClientPrivate;
/**
* PinosClient:
*
* Pinos client object class.
*/
struct _PinosClient {
GObject object;
PinosClientPrivate *priv;
};
/**
* PinosClientClass:
*
* Pinos client object class.
*/
struct _PinosClientClass {
GObjectClass parent_class;
};
/* normal GObject stuff */
GType pinos_client_get_type (void);
PinosClient * pinos_client_new (PinosDaemon *daemon,
const gchar *sender,
PinosProperties *properties);
const gchar * pinos_client_get_sender (PinosClient *client);
const gchar * pinos_client_get_object_path (PinosClient *client);
G_END_DECLS
#endif /* __PINOS_CLIENT_H__ */

View file

@ -26,7 +26,7 @@
#include "pinos/client/pinos.h"
#include "pinos/server/daemon.h"
#include "pinos/server/client.h"
#include "pinos/server/server-node.h"
#include "pinos/dbus/org-pinos.h"
@ -35,6 +35,7 @@
struct _PinosDaemonPrivate
{
PinosDaemon1 *iface;
guint id;
GDBusConnection *connection;
GDBusObjectManagerServer *server_manager;
@ -60,7 +61,7 @@ typedef struct {
} SenderData;
static void
client_name_appeared_handler (GDBusConnection *connection,
sender_name_appeared_handler (GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
gpointer user_data)
@ -74,7 +75,7 @@ client_name_appeared_handler (GDBusConnection *connection,
}
static void
client_name_vanished_handler (GDBusConnection *connection,
sender_name_vanished_handler (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
@ -111,70 +112,90 @@ sender_data_new (PinosDaemon *daemon,
data->id = g_bus_watch_name_on_connection (priv->connection,
sender,
G_BUS_NAME_WATCHER_FLAGS_NONE,
client_name_appeared_handler,
client_name_vanished_handler,
sender_name_appeared_handler,
sender_name_vanished_handler,
data,
(GDestroyNotify) data_free);
return data;
}
static void
handle_disconnect_client (PinosClient *client,
gpointer user_data)
handle_remove_node (PinosServerNode *node,
gpointer user_data)
{
PinosDaemon *daemon = user_data;
PinosDaemonPrivate *priv = daemon->priv;
const gchar *sender;
SenderData *data;
sender = pinos_client_get_sender (client);
sender = pinos_server_node_get_sender (node);
g_debug ("daemon %p: client %p disconnect %s", daemon, client, sender);
g_debug ("daemon %p: sender %s removed node %p", daemon, sender, node);
data = g_hash_table_lookup (priv->senders, sender);
if (data == NULL)
return;
g_debug ("daemon %p: client %p unref", daemon, client);
data->objects = g_list_remove (data->objects, client);
g_object_unref (client);
g_debug ("daemon %p: node %p unref", daemon, node);
data->objects = g_list_remove (data->objects, node);
g_object_unref (node);
}
static gboolean
handle_connect_client (PinosDaemon1 *interface,
GDBusMethodInvocation *invocation,
GVariant *arg_properties,
gpointer user_data)
handle_create_node (PinosDaemon1 *interface,
GDBusMethodInvocation *invocation,
const gchar *arg_factory_name,
const gchar *arg_name,
GVariant *arg_properties,
gpointer user_data)
{
PinosDaemon *daemon = user_data;
PinosDaemonPrivate *priv = daemon->priv;
PinosClient *client;
const gchar *sender, *object_path;
PinosNode *node;
SenderData *data;
const gchar *sender, *object_path;
PinosProperties *props;
sender = g_dbus_method_invocation_get_sender (invocation);
g_debug ("daemon %p: connect client: %s", daemon, sender);
g_debug ("daemon %p: create node: %s", daemon, sender);
props = pinos_properties_from_variant (arg_properties);
client = pinos_client_new (daemon, sender, props);
node = pinos_server_node_new (daemon,
sender,
arg_name,
props);
pinos_properties_free (props);
g_signal_connect (client, "disconnect", (GCallback) handle_disconnect_client, daemon);
if (node == NULL)
goto no_node;
data = g_hash_table_lookup (priv->senders, sender);
if (data == NULL)
data = sender_data_new (daemon, sender);
data->objects = g_list_prepend (data->objects, client);
data->objects = g_list_prepend (data->objects, node);
object_path = pinos_client_get_object_path (client);
g_debug ("daemon %p: added client %p with path %s", daemon, client, object_path);
g_signal_connect (node,
"remove",
(GCallback) handle_remove_node,
daemon);
object_path = pinos_server_node_get_object_path (PINOS_SERVER_NODE (node));
g_debug ("daemon %p: added node %p with path %s", daemon, node, object_path);
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("(o)", object_path));
return TRUE;
/* ERRORS */
no_node:
{
g_debug ("daemon %p: could create node named %s from factory %s", daemon, arg_name, arg_factory_name);
g_dbus_method_invocation_return_dbus_error (invocation,
"org.pinos.Error", "can't create node");
return TRUE;
}
}
static void
@ -185,20 +206,9 @@ export_server_object (PinosDaemon *daemon,
PinosObjectSkeleton *skel;
skel = pinos_object_skeleton_new (PINOS_DBUS_OBJECT_SERVER);
{
PinosDaemon1 *iface;
iface = pinos_daemon1_skeleton_new ();
g_signal_connect (iface, "handle-connect-client", (GCallback) handle_connect_client, daemon);
pinos_daemon1_set_user_name (iface, g_get_user_name ());
pinos_daemon1_set_host_name (iface, g_get_host_name ());
pinos_daemon1_set_version (iface, PACKAGE_VERSION);
pinos_daemon1_set_name (iface, PACKAGE_NAME);
pinos_daemon1_set_cookie (iface, g_random_int());
pinos_daemon1_set_properties (iface, pinos_properties_to_variant (priv->properties));
pinos_object_skeleton_set_daemon1 (skel, iface);
g_object_unref (iface);
}
pinos_object_skeleton_set_daemon1 (skel, priv->iface);
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (skel));
g_object_unref (skel);
}
@ -254,6 +264,23 @@ pinos_daemon_new (PinosProperties *properties)
return g_object_new (PINOS_TYPE_DAEMON, "properties", properties, NULL);
}
const gchar *
pinos_daemon_get_sender (PinosDaemon *daemon)
{
PinosDaemonPrivate *priv;
const gchar *res;
g_return_val_if_fail (PINOS_IS_DAEMON (daemon), NULL);
priv = daemon->priv;
if (priv->connection)
res = g_dbus_connection_get_unique_name (priv->connection);
else
res = NULL;
return res;
}
/**
* pinos_daemon_start:
* @daemon: a #PinosDaemon
@ -505,6 +532,23 @@ pinos_daemon_set_property (GObject *_object,
}
}
static void
pinos_daemon_constructed (GObject * object)
{
PinosDaemon *daemon = PINOS_DAEMON_CAST (object);
PinosDaemonPrivate *priv = daemon->priv;
g_debug ("daemon %p: constructed", object);
pinos_daemon1_set_user_name (priv->iface, g_get_user_name ());
pinos_daemon1_set_host_name (priv->iface, g_get_host_name ());
pinos_daemon1_set_version (priv->iface, PACKAGE_VERSION);
pinos_daemon1_set_name (priv->iface, PACKAGE_NAME);
pinos_daemon1_set_cookie (priv->iface, g_random_int());
pinos_daemon1_set_properties (priv->iface, pinos_properties_to_variant (priv->properties));
G_OBJECT_CLASS (pinos_daemon_parent_class)->constructed (object);
}
static void
pinos_daemon_dispose (GObject * object)
{
@ -525,6 +569,8 @@ pinos_daemon_finalize (GObject * object)
g_debug ("daemon %p: finalize", object);
g_clear_object (&priv->server_manager);
g_clear_object (&priv->iface);
g_hash_table_unref (priv->senders);
G_OBJECT_CLASS (pinos_daemon_parent_class)->finalize (object);
}
@ -536,6 +582,7 @@ pinos_daemon_class_init (PinosDaemonClass * klass)
g_type_class_add_private (klass, sizeof (PinosDaemonPrivate));
gobject_class->constructed = pinos_daemon_constructed;
gobject_class->dispose = pinos_daemon_dispose;
gobject_class->finalize = pinos_daemon_finalize;
@ -560,6 +607,8 @@ pinos_daemon_init (PinosDaemon * daemon)
PinosDaemonPrivate *priv = daemon->priv = PINOS_DAEMON_GET_PRIVATE (daemon);
g_debug ("daemon %p: new", daemon);
priv->iface = pinos_daemon1_skeleton_new ();
g_signal_connect (priv->iface, "handle-create-node", (GCallback) handle_create_node, daemon);
priv->server_manager = g_dbus_object_manager_server_new (PINOS_DBUS_OBJECT_PREFIX);
priv->senders = g_hash_table_new (g_str_hash, g_str_equal);

View file

@ -65,6 +65,7 @@ struct _PinosDaemonClass {
GType pinos_daemon_get_type (void);
PinosDaemon * pinos_daemon_new (PinosProperties *properties);
const gchar * pinos_daemon_get_sender (PinosDaemon *daemon);
void pinos_daemon_start (PinosDaemon *daemon);
void pinos_daemon_stop (PinosDaemon *daemon);

View file

@ -336,10 +336,13 @@ on_property_notify (GObject *obj,
PinosNode *node = user_data;
PinosServerNodePrivate *priv = PINOS_SERVER_NODE (node)->priv;
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "name")) {
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "sender") == 0) {
pinos_node1_set_owner (priv->iface, priv->sender);
}
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "name") == 0) {
pinos_node1_set_name (priv->iface, pinos_node_get_name (node));
}
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "properties")) {
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "properties") == 0) {
PinosProperties *props = pinos_node_get_properties (node);
pinos_node1_set_properties (priv->iface, props ? pinos_properties_to_variant (props) : NULL);
}
@ -349,12 +352,18 @@ static void
pinos_server_node_constructed (GObject * obj)
{
PinosServerNode *node = PINOS_SERVER_NODE (obj);
PinosServerNodePrivate *priv = node->priv;
g_debug ("server-node %p: constructed", node);
g_signal_connect (node, "notify", (GCallback) on_property_notify, node);
G_OBJECT_CLASS (pinos_server_node_parent_class)->constructed (obj);
if (priv->sender == NULL) {
priv->sender = g_strdup (pinos_daemon_get_sender (priv->daemon));
pinos_node1_set_owner (priv->iface, priv->sender);
}
node_register_object (node);
}
@ -378,6 +387,7 @@ pinos_server_node_finalize (GObject * obj)
g_debug ("server-node %p: finalize", node);
g_clear_object (&priv->daemon);
g_clear_object (&priv->iface);
g_free (priv->sender);
G_OBJECT_CLASS (pinos_server_node_parent_class)->finalize (obj);
}

View file

@ -164,8 +164,6 @@ on_property_notify (GObject *obj,
PinosPort *port = PINOS_PORT (obj);
PinosServerPortPrivate *priv = PINOS_SERVER_PORT (port)->priv;
g_debug ("port %p: update %s", port, pspec ? g_param_spec_get_name (pspec) : "NULL");
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "node") == 0) {
PinosServerNode *node = PINOS_SERVER_NODE (pinos_port_get_node (port));
pinos_port1_set_node (priv->iface, pinos_server_node_get_object_path (node));