projects
/
platform
/
upstream
/
glib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
505b7b2
)
[Sending] sender in outgoing message set.
author
Michal Eljasiewicz
<m.eljasiewic@samsung.com>
Fri, 27 Sep 2013 14:04:12 +0000
(16:04 +0200)
committer
Lukasz Skalski
<l.skalski@partner.samsung.com>
Fri, 25 Oct 2013 14:36:18 +0000
(16:36 +0200)
gio/gdbusconnection.c
patch
|
blob
|
history
gio/gdbusprivate.c
patch
|
blob
|
history
gio/gdbusprivate.h
patch
|
blob
|
history
gio/gkdbus.c
patch
|
blob
|
history
gio/gkdbus.h
patch
|
blob
|
history
diff --git
a/gio/gdbusconnection.c
b/gio/gdbusconnection.c
index
ae654a5
..
529a550
100644
(file)
--- a/
gio/gdbusconnection.c
+++ b/
gio/gdbusconnection.c
@@
-1648,6
+1648,12
@@
g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
error))
goto out;
error))
goto out;
+ if(g_kdbus_get_sender(g_dbus_worker_get_kdbus(connection->worker)) != NULL)
+ {
+ g_dbus_message_set_sender(message, g_kdbus_get_sender(g_dbus_worker_get_kdbus(connection->worker)));
+ g_print ("g_dbus_connection_send_message_unlocked: set_sender ok: ! \n");
+ }
+
blob = g_dbus_message_to_blob (message,
&blob_size,
connection->capabilities,
blob = g_dbus_message_to_blob (message,
&blob_size,
connection->capabilities,
diff --git
a/gio/gdbusprivate.c
b/gio/gdbusprivate.c
index
ee55ff4
..
6525db3
100644
(file)
--- a/
gio/gdbusprivate.c
+++ b/
gio/gdbusprivate.c
@@
-1652,6
+1652,10
@@
_g_dbus_worker_send_message (GDBusWorker *worker,
}
/* ---------------------------------------------------------------------------------------------------- */
}
/* ---------------------------------------------------------------------------------------------------- */
+GKdbus* g_dbus_worker_get_kdbus (GDBusWorker *worker)
+{
+ return worker->kdbus;
+}
GDBusWorker *
_g_dbus_worker_new (GIOStream *stream,
GDBusWorker *
_g_dbus_worker_new (GIOStream *stream,
diff --git
a/gio/gdbusprivate.h
b/gio/gdbusprivate.h
index
5e6217b
..
6b11481
100644
(file)
--- a/
gio/gdbusprivate.h
+++ b/
gio/gdbusprivate.h
@@
-81,8
+81,9
@@
void _g_dbus_worker_close (GDBusWorker *worker,
GCancellable *cancellable,
GSimpleAsyncResult *result);
/* Samsung change */
GCancellable *cancellable,
GSimpleAsyncResult *result);
/* Samsung change */
-void _g_dbus_worker_queue_or_deliver_received_message (GDBusWorker *worker,
+void
_g_dbus_worker_queue_or_deliver_received_message (GDBusWorker *worker,
GDBusMessage *message);
GDBusMessage *message);
+GKdbus* g_dbus_worker_get_kdbus (GDBusWorker *worker);
/* ---------------------------------------------------------------------------------------------------- */
void _g_dbus_initialize (void);
/* ---------------------------------------------------------------------------------------------------- */
void _g_dbus_initialize (void);
diff --git
a/gio/gkdbus.c
b/gio/gkdbus.c
index
2d3a89e
..
ed5f837
100644
(file)
--- a/
gio/gkdbus.c
+++ b/
gio/gkdbus.c
@@
-95,6
+95,7
@@
struct _GKdbusPrivate
guint inited : 1;
gchar *buffer_ptr;
gint peer_id;
guint inited : 1;
gchar *buffer_ptr;
gint peer_id;
+ gchar *sender;
};
// TODO:
};
// TODO:
@@
-165,6
+166,7
@@
g_kdbus_init (GKdbus *kdbus)
kdbus->priv->path = NULL;
kdbus->priv->buffer_ptr = NULL;
kdbus->priv->peer_id = -1;
kdbus->priv->path = NULL;
kdbus->priv->buffer_ptr = NULL;
kdbus->priv->peer_id = -1;
+ kdbus->priv->sender = NULL;
}
static gboolean
}
static gboolean
@@
-408,6
+410,14
@@
g_kdbus_receive (GKdbus *kdbus,
return ret_size;
}
return ret_size;
}
+gchar* g_kdbus_get_sender(GKdbus *kdbus)
+{
+ return kdbus->priv->sender;
+}
+
+/*
+ * TODO add checks for mallocs
+ */
static gboolean
g_kdbus_send_reply(GDBusWorker *worker,
GKdbus *kdbus,
static gboolean
g_kdbus_send_reply(GDBusWorker *worker,
GKdbus *kdbus,
@@
-415,6
+425,7
@@
g_kdbus_send_reply(GDBusWorker *worker,
{
GDBusMessage *reply = NULL;
char *unique_name = NULL;
{
GDBusMessage *reply = NULL;
char *unique_name = NULL;
+ char *sender = NULL;
reply = g_dbus_message_new_method_reply(dbus_msg);
g_dbus_message_set_sender(reply, "org.freedesktop.DBus");
reply = g_dbus_message_new_method_reply(dbus_msg);
g_dbus_message_set_sender(reply, "org.freedesktop.DBus");
@@
-422,8
+433,14
@@
g_kdbus_send_reply(GDBusWorker *worker,
unique_name = malloc(30); // TODO should allow for Kdbus peer ID max value ?
sprintf(unique_name, "%i", kdbus->priv->peer_id);
unique_name = malloc(30); // TODO should allow for Kdbus peer ID max value ?
sprintf(unique_name, "%i", kdbus->priv->peer_id);
+ sender = malloc (strlen(unique_name) + 4);
+ //if(!sender)
+
+ sprintf(sender, ":1.%s", unique_name);
+ kdbus->priv->sender = sender;
+ g_print ("g_kdbus_send_reply: sender set to:%s! \n", kdbus->priv->sender);
+
g_dbus_message_set_body(reply, g_variant_new ("(s)", unique_name));
g_dbus_message_set_body(reply, g_variant_new ("(s)", unique_name));
-
_g_dbus_worker_queue_or_deliver_received_message (worker, reply);
}
_g_dbus_worker_queue_or_deliver_received_message (worker, reply);
}
@@
-463,7
+480,7
@@
g_kdbus_send_message (GDBusWorker *worker,
g_kdbus_send_reply(worker, kdbus, dbus_msg);
g_kdbus_send_reply(worker, kdbus, dbus_msg);
-
+ g_print ("kdbus_send_message: hello sent! \n");
goto out;
}
goto out;
}
@@
-493,10
+510,10
@@
g_kdbus_send_message (GDBusWorker *worker,
kmsg->size = kmsg_size;
kmsg->payload_type = KDBUS_PAYLOAD_DBUS1;
kmsg->dst_id = dst ? 0 : dst_id;
kmsg->size = kmsg_size;
kmsg->payload_type = KDBUS_PAYLOAD_DBUS1;
kmsg->dst_id = dst ? 0 : dst_id;
- kmsg->src_id =
strtoull(g_dbus_message_get_sender(dbus_msg), NULL , 10)
;
+ kmsg->src_id =
kdbus->priv->peer_id
;
kmsg->cookie = g_dbus_message_get_serial(dbus_msg);
kmsg->cookie = g_dbus_message_get_serial(dbus_msg);
-
- g_print ("kdbus_send_message
unique_name/message->sender: %s \n", g_dbus_message_get_sender(dbus_msg)
);
+ g_print ("kdbus_send_message: serial: %i \n", kmsg->cookie);
+ g_print ("kdbus_send_message
: src_id/peer_id: %i \n", kdbus->priv->peer_id
);
// build message contents
item = kmsg->items;
// build message contents
item = kmsg->items;
@@
-526,7
+543,7
@@
again:
else
g_warning ("g_kdbus_send_message: ioctl error sending kdbus message: %d (%m) \n", errno);
}
else
g_warning ("g_kdbus_send_message: ioctl error sending kdbus message: %d (%m) \n", errno);
}
-
+ g_print ("kdbus_send_message: ioctl(CMD_MSG_SEND) sent successfully \n");
free(kmsg);
out:
free(kmsg);
out:
diff --git
a/gio/gkdbus.h
b/gio/gkdbus.h
index
f60b09e
..
c42e53e
100644
(file)
--- a/
gio/gkdbus.h
+++ b/
gio/gkdbus.h
@@
-100,6
+100,8
@@
gssize g_kdbus_send_message (GDBusWorker *worker
GError **error);
GLIB_AVAILABLE_IN_ALL
gboolean g_kdbus_register (GKdbus *kdbus);
GError **error);
GLIB_AVAILABLE_IN_ALL
gboolean g_kdbus_register (GKdbus *kdbus);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_kdbus_get_sender (GKdbus *kdbus);
G_END_DECLS
G_END_DECLS