Branch: Tag:

2020-06-22

2020-06-22 12:53:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

SNMP.Updateable: UNDEFINED now causes the old value to be kept.

It isn't always possible to update the value synchronously, so
allow the update callback to return a "temporarily unavailable"
indicator value (ie UNDEFINED).

Needed for [EP-1682].

24:      class Updateable(function(:mixed) fun)   { -  void update_value() +  int(0..1) update_value()    {    if (fun) {    mixed val = fun();    if (undefinedp (val)) { -  werror("SNMP: Got undefined value from callback %O.\n" -  "%s\n", -  fun, describe_backtrace(backtrace())); +  // Value not available at this time. +  // Keep the stale value. +  return 0;    }    this_object()->init (val);    this_object()->der = UNDEFINED;    } -  +  return 1;    }   }