diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-03-03 02:46:54 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-03-03 03:27:27 +0100 |
commit | 4233cc60fa32a8132dd54303fcbbaee2c44c79e4 (patch) | |
tree | 4ee190d40266fabbddb6f24dad37edb3a35fc44e /pkg/backend/callbacks.go | |
parent | 3e8193f109e3d10aa0c36ef9ae22382463a07403 (diff) |
[pkg] relax reflect 1.14 requirement
Diffstat (limited to 'pkg/backend/callbacks.go')
-rw-r--r-- | pkg/backend/callbacks.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/pkg/backend/callbacks.go b/pkg/backend/callbacks.go index 5fb8642..eb12655 100644 --- a/pkg/backend/callbacks.go +++ b/pkg/backend/callbacks.go @@ -2,7 +2,6 @@ package backend import ( "fmt" - "reflect" "sync" "unsafe" ) @@ -40,14 +39,18 @@ const OnStatusChanged string = "OnStatusChanged" func subscribe(event string, fp unsafe.Pointer) { callbackMutex.Lock() defer callbackMutex.Unlock() - e := &Events{} - v := reflect.Indirect(reflect.ValueOf(&e)) - hf := v.Elem().FieldByName(event) - if reflect.ValueOf(hf).IsZero() { - fmt.Println("ERROR: not a valid event:", event) - } else { - callbacks[event] = (*[0]byte)(fp) - } + /* I'm commenting this check because it imposes 1.14, which is only in buster-backports. + We can re-add it after buster is oldstable + e := &Events{} + v := reflect.Indirect(reflect.ValueOf(&e)) + hf := v.Elem().FieldByName(event) + if reflect.ValueOf(hf).IsZero() { + fmt.Println("ERROR: not a valid event:", event) + } else { + callbacks[event] = (*[0]byte)(fp) + } + */ + callbacks[event] = (*[0]byte)(fp) } // trigger fires a callback from C-land. |