sync_struct: pass mod to notify callback

This commit is contained in:
Sebastien Bourdeauducq 2015-01-14 22:21:59 +08:00
parent 070788a680
commit 33283feacb
2 changed files with 7 additions and 7 deletions

View File

@ -66,15 +66,15 @@ class Subscriber:
line = yield from self._reader.readline()
if not line:
return
obj = pyon.decode(line.decode())
mod = pyon.decode(line.decode())
if obj["action"] == "init":
target = self.target_builder(obj["struct"])
if mod["action"] == "init":
target = self.target_builder(mod["struct"])
else:
process_mod(target, obj)
process_mod(target, mod)
if self.notify_cb is not None:
self.notify_cb()
self.notify_cb(mod)
class Notifier:

View File

@ -201,7 +201,7 @@ def _show_list(args, notifier_name, display_fun):
l[:] = x
return l
subscriber = Subscriber(notifier_name, init_l,
lambda: display_fun(l))
lambda mod: display_fun(l))
_run_subscriber(args.server, args.port, subscriber)
@ -212,7 +212,7 @@ def _show_dict(args, notifier_name, display_fun):
d.update(x)
return d
subscriber = Subscriber(notifier_name, init_d,
lambda: display_fun(d))
lambda mod: display_fun(d))
_run_subscriber(args.server, args.port, subscriber)