|
@@ -232,11 +232,11 @@ func GetContainerNetworks(containers []string) map[string]string {
|
|
|
// update broadcastState with a map of items
|
|
// update broadcastState with a map of items
|
|
|
func UpdateBroadcastState(values map[string]interface{}) error {
|
|
func UpdateBroadcastState(values map[string]interface{}) error {
|
|
|
mu.Lock()
|
|
mu.Lock()
|
|
|
- defer mu.Unlock()
|
|
|
|
|
v := reflect.ValueOf(&broadcastState).Elem()
|
|
v := reflect.ValueOf(&broadcastState).Elem()
|
|
|
for key, value := range values {
|
|
for key, value := range values {
|
|
|
field := v.FieldByName(key)
|
|
field := v.FieldByName(key)
|
|
|
if !field.IsValid() || !field.CanSet() {
|
|
if !field.IsValid() || !field.CanSet() {
|
|
|
|
|
+ mu.Unlock()
|
|
|
return fmt.Errorf("field %s does not exist or is not settable", key)
|
|
return fmt.Errorf("field %s does not exist or is not settable", key)
|
|
|
}
|
|
}
|
|
|
val := reflect.ValueOf(value)
|
|
val := reflect.ValueOf(value)
|
|
@@ -244,6 +244,7 @@ func UpdateBroadcastState(values map[string]interface{}) error {
|
|
|
val = val.Elem() // Extract the underlying value from the interface
|
|
val = val.Elem() // Extract the underlying value from the interface
|
|
|
}
|
|
}
|
|
|
if err := recursiveUpdate(field, val); err != nil {
|
|
if err := recursiveUpdate(field, val); err != nil {
|
|
|
|
|
+ mu.Unlock()
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|