svc/conntrack.in: Hoist `netupdown' above `kickpeers'.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 28 Sep 2017 17:58:07 +0000 (18:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 28 Jun 2018 23:29:23 +0000 (00:29 +0100)
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

index 3368295..1ccbae6 100644 (file)
@@ -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.