GDBusMessage *message,
GDBusSendMessageFlags flags,
volatile guint32 *out_serial,
- GError **error)
+ GError **error,
+ gint timeout_msec)
{
guchar *blob;
gsize blob_size;
#ifdef G_OS_UNIX
else if (connection->kdbus_worker)
{
- ret = _g_kdbus_worker_send_message (connection->kdbus_worker, message, -1, error);
+ ret = _g_kdbus_worker_send_message (connection->kdbus_worker, message, timeout_msec, error);
}
#endif
else
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
CONNECTION_LOCK (connection);
- ret = g_dbus_connection_send_message_unlocked (connection, message, flags, out_serial, error);
+ ret = g_dbus_connection_send_message_unlocked (connection, message, flags, out_serial, error, -1);
CONNECTION_UNLOCK (connection);
return ret;
}
if (out_serial == NULL)
out_serial = &serial;
- if (timeout_msec == -1)
- timeout_msec = 25 * 1000;
-
simple = g_simple_async_result_new (G_OBJECT (connection),
callback,
user_data,
}
error = NULL;
- if (!g_dbus_connection_send_message_unlocked (connection, message, flags, out_serial, &error))
+ if (!g_dbus_connection_send_message_unlocked (connection, message, flags, out_serial, &error, timeout_msec))
{
g_simple_async_result_take_error (simple, error);
g_simple_async_result_complete_in_idle (simple);
(GDestroyNotify) send_message_data_unref);
}
- if (timeout_msec != G_MAXINT)
+ if (timeout_msec != G_MAXINT
+#ifdef G_OS_UNIX
+ /* Userspace timeouts unnecessary on unix/kdbus - kdbus handles timeouts. */
+ && !connection->kdbus_worker
+#endif
+ )
{
- data->timeout_source = g_timeout_source_new (timeout_msec);
+ data->timeout_source = g_timeout_source_new (timeout_msec == -1 ? DBUS_DEFAULT_TIMEOUT_MSEC : timeout_msec);
g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
g_source_set_callback (data->timeout_source,
send_message_with_reply_timeout_cb,
message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
NULL,
- &error))
+ &error,
+ -1))
{
g_critical ("Error while sending AddMatch() message: %s", error->message);
g_error_free (error);
message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
NULL,
- &error))
+ &error,
+ -1))
{
/* If we could get G_IO_ERROR_CLOSED here, it wouldn't be reasonable to
* critical; but we're holding the lock, and our caller checked whether
"org.freedesktop.DBus.Error.InvalidArgs",
_("No such property '%s'"),
property_name);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
"org.freedesktop.DBus.Error.InvalidArgs",
_("Property '%s' is not readable"),
property_name);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
"org.freedesktop.DBus.Error.InvalidArgs",
_("Property '%s' is not writable"),
property_name);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
_("Error setting property '%s': Expected type '%s' but got '%s'"),
property_name, property_info->signature,
g_variant_get_type_string (value));
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_variant_unref (value);
g_object_unref (reply);
handled = TRUE;
"org.freedesktop.DBus.Error.InvalidArgs",
_("No such interface '%s'"),
interface_name);
- g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
"org.freedesktop.DBus.Error.InvalidArgs",
_("No such interface"),
interface_name);
- g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
reply = g_dbus_message_new_method_reply (message);
g_dbus_message_set_body (reply, g_variant_new ("(s)", s->str));
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
g_string_free (s, TRUE);
"org.freedesktop.DBus.Error.UnknownMethod",
_("No such method '%s'"),
g_dbus_message_get_member (message));
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
handled = TRUE;
goto out;
_("Type of message, '%s', does not match expected type '%s'"),
g_variant_get_type_string (parameters),
type_string);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_variant_type_free (in_type);
g_variant_unref (parameters);
g_object_unref (reply);
{
GDBusMessage *reply;
reply = g_dbus_message_new_method_reply (message);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
}
reply = g_dbus_message_new_method_reply (message);
g_dbus_message_set_body (reply, g_variant_new ("(s)", connection->machine_id));
}
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
}
reply = g_dbus_message_new_method_reply (message);
g_dbus_message_set_body (reply, g_variant_new ("(s)", s->str));
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
g_string_free (s, TRUE);
}
_("No such interface '%s' on object at path %s"),
interface_name,
object_path);
- g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL, -1);
g_object_unref (reply);
out: