Skip to content
Snippets Groups Projects
Unverified Commit 4233cc60 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[pkg] relax reflect 1.14 requirement

parent 3e8193f1
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment