From 4f6b41b9fafa19b941298abd7c19f5757b461a2a Mon Sep 17 00:00:00 2001 Message-Id: <4f6b41b9fafa19b941298abd7c19f5757b461a2a.1715137312.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 28 Sep 2017 18:58:07 +0100 Subject: [PATCH] svc/conntrack.in: Hoist `netupdown' above `kickpeers'. Organization: Straylight/Edgeware From: Mark Wooding This will be part of a collection of little functions, and some will definitely want to be above `kickpeers'. It seems silly to separate them with this monster function. --- svc/conntrack.in | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/svc/conntrack.in b/svc/conntrack.in index 3368295a..1ccbae66 100644 --- a/svc/conntrack.in +++ b/svc/conntrack.in @@ -237,6 +237,16 @@ def localaddr(peer): sk.close() _kick = T.Queue() + +def netupdown(upness, reason): + """ + Add or kill peers according to whether the network is up or down. + + UPNESS is true if the network is up, or false if it's down. + """ + + _kick.put((upness, reason)) + def kickpeers(): while True: upness, reason = _kick.get() @@ -332,15 +342,6 @@ def kickpeers(): SM.notify('conntrack', upness and 'up' or 'down', *select + reason) for c in changes: c() -def netupdown(upness, reason): - """ - Add or kill peers according to whether the network is up or down. - - UPNESS is true if the network is up, or false if it's down. - """ - - _kick.put((upness, reason)) - ###-------------------------------------------------------------------------- ### NetworkManager monitor. -- [mdw]