Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Revert back to reflect.Ptr #182

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions api/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,22 @@ func (b *Beacon) WatchDeviceChanges(ctx context.Context) (chan bool, error) {
ch := make(chan bool)

go func() {
defer close(ch)
for {
select {
case changed := <-b.propchanged:

if changed == nil {
ctx.Done()
return
}

if changed.Name == "ManufacturerData" || changed.Name == "ServiceData" {
ch <- b.Parse()
}

break
case <-ctx.Done():
b.propchanged <- nil
close(ch)
break
return
}
}
}()
Expand Down
4 changes: 2 additions & 2 deletions util/map_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ func mapStructField(obj interface{}, name string, value dbus.Variant) error {
if val.Type().Kind() == reflect.Map {

if structFieldType.Kind() == reflect.Struct ||
(structFieldType.Kind() == reflect.Pointer && structFieldType.Elem().Kind() == reflect.Struct) {
(structFieldType.Kind() == reflect.Ptr && structFieldType.Elem().Kind() == reflect.Struct) {

variantMap, ok := value.Value().(map[string]dbus.Variant)
if ok {
if structFieldType.Kind() == reflect.Pointer {
if structFieldType.Kind() == reflect.Ptr {
if structFieldValue.IsZero() {
return fmt.Errorf("Pointer field %s: uninitialized", name)
}
Expand Down