_dbus_string_init_const(&unique_name, ":1.1"); //dbus_bus_get_unique_name(context->myConnection)); this is without :1.
if(!bus_connection_complete(context->myKdbusConnection, &unique_name, error))
{
- _dbus_verbose ("bus connection complete failed for kdbus\n");
+ _dbus_verbose ("Bus connection complete failed for kdbus!\n");
_dbus_string_free(&unique_name);
goto failed;
}
_dbus_string_free(&unique_name);
+
+ if(!register_kdbus_starters(context->myKdbusConnection))
+ {
+ _dbus_verbose ("Registering kdbus starters for dbus activatable names failed!\n");
+ goto failed;
+ }
}
return context;
#include <dbus/dbus-transport.h>
#include <dbus/dbus-transport-kdbus.h>
#include "connection.h"
+#include "activation.h"
#include <utils.h>
#include <stdlib.h>
dbus_bus_set_bus_connection_address(type, address);
- connection = dbus_bus_get(type, error);
+ connection = dbus_bus_get(type, error); /*todo possibly could be optimised by using lower functions*/
if(connection == NULL)
return NULL;
if(kdbus_request_name(connection, &daemon_name, 0, 0) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
goto failed;
-// dbus_bus_add_match(connection, "type='signal', member='NameAcquired'", error); //not needed if request name ioctled by daemon not libdbus
-// dbus_bus_add_match(connection, "type='signal', member='NameLost'", error); //todo dispatch and digest this or ioctl about name where daemon checks name presence
- if(!add_match_kdbus (dbus_connection_get_transport(connection), 1, "type='signal', member='NameLost'"))
+ if(!add_match_kdbus (dbus_connection_get_transport(connection), 1, "type='signal', member='NameLost'")) //todo handle tis in dispatch
{
dbus_set_error (error, _dbus_error_from_errno (errno), "Could not add match for id:1, %s", _dbus_strerror_from_errno ());
return FALSE;
return phantom_connection;
}
+
+dbus_bool_t register_kdbus_starters(DBusConnection* connection)
+{
+ int i, len;
+ char **services;
+ dbus_bool_t retval = FALSE;
+ int fd;
+
+ if (!bus_activation_list_services (bus_connection_get_activation (connection), &services, &len))
+ return FALSE;
+
+ _dbus_transport_get_socket_fd(dbus_connection_get_transport(connection), &fd);
+
+ /* for(i=0; i<len; i++)
+ {
+ if (request_kdbus_name(fd, services[i], DBUS_NAME_FLAG_ALLOW_REPLACEMENT, 1) < 0)
+ goto out;
+ }*/
+ retval = TRUE;
+
+out:
+ dbus_free_string_array (services);
+ return retval;
+}
if (!bus_service_add_owner (service, phantom, flags, transaction, error))
goto out; /* todo FIXME what to do with phantom connection? look into create_phantom_connection for a clue*/
if(*result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
- if (!bus_service_remove_owner (service, connection, transaction, error))
- goto out; /* todo FIXME what to do with phantom connection? look into create_phantom_connection for a clue*/
+ {
+ if(_bus_service_find_owner_link (service, connection))
+ if (!bus_service_remove_owner (service, connection, transaction, error))
+ goto out; /* todo FIXME what to do with phantom connection? look into create_phantom_connection for a clue*/
+ }
}
activation = bus_context_get_activation (registry->context);