Skip to content

Commit

Permalink
Use consistent naming for object managment services
Browse files Browse the repository at this point in the history
  • Loading branch information
idleroamer committed May 2, 2021
1 parent 27266cd commit 7685c99
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions objectManager/objectmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (o *objectManager) init(conn *dbus.Conn) {

o.adapter.dbusServiceNamePattern = os.Getenv("DBUS_SERVICE_NAME_PATTERN")
if o.adapter.dbusServiceNamePattern == "" {
o.adapter.dbusServiceNamePattern = "qface.registry"
o.adapter.dbusServiceNamePattern = "qface.service"
}
postfix := strings.ReplaceAll(conn.Names()[0], ".", "")
postfix = strings.ReplaceAll(postfix, ":", "")
Expand Down Expand Up @@ -109,11 +109,16 @@ func (o *objectManager) watchService(serviceOwner string) {
select {
case call := <-ch:
if call.Err == nil {
objectPaths := call.Body[0].(map[dbus.ObjectPath]map[string]map[string]dbus.Variant)
for k := range objectPaths {
o.objectServices[k] = serviceOwner
for _, observer := range o.interfacesAddedObservers {
go observer.OnInterfacesAdded(serviceOwner, k)
if objectPaths, ok := call.Body[0].(map[dbus.ObjectPath]map[string]map[string]dbus.Variant); ok {
for k := range objectPaths {
o.objectServices[k] = serviceOwner
for _, observer := range o.interfacesAddedObservers {
go observer.OnInterfacesAdded(serviceOwner, k)
}
}
} else {
if call.Body[0] != nil {
log.Printf("Response of GetManagedObjects of service %s is not in expected format", serviceOwner)
}
}
} else {
Expand Down

0 comments on commit 7685c99

Please sign in to comment.