anoia service :events method behaves as iterator
This commit is contained in:
parent
7904c6bfe9
commit
8f97c5bf3c
2 changed files with 13 additions and 6 deletions
|
@ -31,14 +31,14 @@
|
|||
new-addresses))
|
||||
|
||||
(fn run []
|
||||
(var addresses [])
|
||||
(let [[state-directory wan-device] arg
|
||||
dir (svc.open state-directory)]
|
||||
(var addresses [])
|
||||
(while true
|
||||
(while (not (dir:ready?)) (dir:wait))
|
||||
(when (. bound-states (dir:output "state"))
|
||||
(each [v (dir:events)]
|
||||
;; we don't handle unbound or stopped, where we should
|
||||
;; take the addresses away
|
||||
(when (. bound-states (v:output "state"))
|
||||
(set addresses
|
||||
(update-addresses wan-device addresses (dir:output "address"))))
|
||||
(dir:wait))))
|
||||
(update-addresses wan-device addresses (v:output "address")))))))
|
||||
|
||||
{ : update-addresses : changes : run }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue