[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Slightly abstract the facilitator polling interval.



commit 4f8e1e19b3b29c13bd6ed2f6fdb0924db393f098
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Mar 2 01:16:29 2013 -0800

    Slightly abstract the facilitator polling interval.
---
 facilitator/facilitator |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/facilitator/facilitator b/facilitator/facilitator
index 715ddec..0f16620 100755
--- a/facilitator/facilitator
+++ b/facilitator/facilitator
@@ -255,13 +255,14 @@ class Handler(SocketServer.StreamRequestHandler):
             log(u"error getting reg for proxy address %s: %s" % (safe_str(repr(proxy_spec)), safe_str(repr(str(e)))))
             self.send_error()
             return False
+        check_back_in = get_check_back_in_for_proxy(proxy_addr)
         if reg:
             log(u"proxy gets %s, relay %s (now %d)" %
                 (safe_str(unicode(reg)), options.relay_spec, num_regs()))
-            print >> self.wfile, fac.render_transaction("OK", ("CLIENT", str(reg)), ("RELAY", options.relay_spec), ("CHECK-BACK-IN", str(POLL_INTERVAL)))
+            print >> self.wfile, fac.render_transaction("OK", ("CLIENT", str(reg)), ("RELAY", options.relay_spec), ("CHECK-BACK-IN", str(check_back_in)))
         else:
             log(u"proxy gets none")
-            print >> self.wfile, fac.render_transaction("NONE", ("CHECK-BACK-IN", str(POLL_INTERVAL)))
+            print >> self.wfile, fac.render_transaction("NONE", ("CHECK-BACK-IN", str(check_back_in)))
         return True
 
     def do_PUT(self, params):
@@ -330,6 +331,10 @@ def get_reg_for_proxy(proxy_addr):
     REGS = regs_for_af(af)
     return REGS.fetch()
 
+def get_check_back_in_for_proxy(proxy_addr):
+    """Get a CHECK-BACK-IN interval suitable for this proxy."""
+    return POLL_INTERVAL
+
 def put_reg(reg):
     """Add a registration."""
     addr_str = reg.host



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits