if (!check_initialized (connection))
return;
- g_assert (connection->worker != NULL);
- _g_dbus_worker_unfreeze (connection->worker);
+ g_assert (connection->worker || connection->kdbus_worker);
+
+ if (connection->kdbus_worker)
+ g_kdbus_worker_unfreeze (connection->kdbus_worker);
+ else
+ _g_dbus_worker_unfreeze (connection->worker);
}
/**
/* Called in GDBusWorker's thread - we must not block - with no lock held */
static void
-on_worker_message_received (GDBusWorker *worker,
- GDBusMessage *message,
+on_worker_message_received (GDBusMessage *message,
gpointer user_data)
{
GDBusConnection *connection;
/* Called in GDBusWorker's thread, lock is not held */
static GDBusMessage *
-on_worker_message_about_to_be_sent (GDBusWorker *worker,
- GDBusMessage *message,
+on_worker_message_about_to_be_sent (GDBusMessage *message,
gpointer user_data)
{
GDBusConnection *connection;
/* Called in GDBusWorker's thread - we must not block - without lock held */
static void
-on_worker_closed (GDBusWorker *worker,
- gboolean remote_peer_vanished,
- GError *error,
- gpointer user_data)
+on_worker_closed (gboolean remote_peer_vanished,
+ GError *error,
+ gpointer user_data)
{
GDBusConnection *connection;
gboolean alive;
GError **error)
{
GDBusConnection *connection = G_DBUS_CONNECTION (initable);
+ gboolean initially_frozen;
gboolean ret;
/* This method needs to be idempotent to work with the singleton
ret = g_dbus_address_get_stream_internal (connection->address, TRUE,
NULL, /* TODO: out_guid */
cancellable, &connection->initialization_error);
-
if (ret == NULL)
goto out;
g_hash_table_insert (alive_connections, connection, connection);
G_UNLOCK (message_bus_lock);
- if (!connection->kdbus_worker)
- connection->worker = _g_dbus_worker_new (connection->stream,
- connection->capabilities,
- ((connection->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) != 0),
- on_worker_message_received,
- on_worker_message_about_to_be_sent,
- on_worker_closed,
- connection);
+ initially_frozen = (connection->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) != 0;
+
+ if (connection->kdbus_worker)
+ g_kdbus_worker_associate (connection->kdbus_worker,
+ connection->capabilities,
+ on_worker_message_received,
+ on_worker_message_about_to_be_sent,
+ on_worker_closed,
+ connection);
+ else
+ connection->worker = _g_dbus_worker_new (connection->stream,
+ connection->capabilities,
+ initially_frozen,
+ on_worker_message_received,
+ on_worker_message_about_to_be_sent,
+ on_worker_closed,
+ connection);
/* if a bus connection, call org.freedesktop.DBus.Hello - this is how we're getting a name */
if (connection->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
//g_debug ("unique name is '%s'", connection->bus_unique_name);
}
+ if (connection->kdbus_worker && !initially_frozen)
+ g_kdbus_worker_unfreeze (connection->kdbus_worker);
+
ret = TRUE;
out:
if (!ret)
if (connection->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
{
if (!is_signal_data_for_name_lost_or_acquired (signal_data))
- add_match_rule (connection, signal_data->rule);
+ if (connection->kdbus_worker)
+ _g_kdbus_AddMatch (connection->kdbus_worker, signal_data->rule, subscriber.id);
+ else
+ add_match_rule (connection, signal_data->rule);
else
{
if (connection->kdbus_worker)
* so on_worker_closed() can't happen between the check we just
* did, and releasing the lock later.
*/
- remove_match_rule (connection, signal_data->rule);
+ if (connection->kdbus_worker)
+ _g_kdbus_RemoveMatch (connection->kdbus_worker, subscription_id);
+ else
+ remove_match_rule (connection, signal_data->rule);
}
else
{