X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/22b4755242c39bc8e948e4b714bea80433882a11..799e58b96ef4948629d5e1b5401f537d74082ab7:/svc/watch.in diff --git a/svc/watch.in b/svc/watch.in index e058ed8e..140f1fce 100644 --- a/svc/watch.in +++ b/svc/watch.in @@ -525,26 +525,35 @@ class Pinger (T.Coroutine): installed, and again by the dbwatcher coroutine when it detects a change to the database. """ + if T._debug: print '# rescan peers' correct = {} + start = {} for peer in S.list(): try: info = peerinfo(peer) except KeyError: continue if boolean(info, 'watch', False): - correct[peer] = info + if T._debug: print '# interesting peer %s' % peer + correct[peer] = start[peer] = info + elif startup: + if T._debug: print '# peer %s ready for adoption' % peer + start[peer] = info for peer, obj in me._peers.items(): if peer in correct: obj.update(correct[peer]) else: + if T._debug: print '# peer %s vanished' % peer del me._peers[peer] - for peer, info in correct.iteritems(): + for peer, info in start.iteritems(): if peer not in me._peers: if startup: + if T._debug: print '# setting up peer %s' % peer ifname = S.ifname(peer) addr = S.addr(peer) T.defer(addpeer, info, peer, ifname, *addr) else: + if T._debug: print '# adopting new peer %s' % peer me.add(peer, info, True) return me