[tor-commits] [flashproxy/master] Return polling interval in get_reg().

dcf at torproject.org dcf at torproject.org
Sat Mar 2 09:22:14 UTC 2013


commit 6157da5a7af867ec00f14b5da32ccebb548a1818
Author: Alexandre Allaire <alexandre.allaire at mail.mcgill.ca>
Date:   Thu Feb 7 18:13:26 2013 -0500

    Return polling interval in get_reg().
    
    Check that the polling interval reveived from the facilitator is a
    numeric value and return it to the caller, along with client and relay
    specs.
---
 facilitator/fac.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/facilitator/fac.py b/facilitator/fac.py
index 9d77b95..7d55221 100644
--- a/facilitator/fac.py
+++ b/facilitator/fac.py
@@ -217,9 +217,17 @@ def get_reg(facilitator_addr, proxy_addr):
         command, params = transact(f, "GET", ("FROM", format_addr(proxy_addr)))
     finally:
         f.close()
+    check_back_in = param_first("CHECK-BACK-IN", params)
+    if not check_back_in:
+        raise ValueError("Facilitator did not return polling interval.")
+    try:
+        float(check_back_in)
+    except ValueError:
+        raise ValueError("Facilitator returned non-numeric polling interval.")
     if command == "NONE":
         return {
-            "client": ""
+            "client": "",
+            "check-back-in": check_back_in,
         }
     elif command == "OK":
         client_spec = param_first("CLIENT", params)
@@ -234,6 +242,7 @@ def get_reg(facilitator_addr, proxy_addr):
         return {
             "client": format_addr(client),
             "relay": format_addr(relay),
+            "check-back-in": check_back_in,
         }
     else:
         raise ValueError("Facilitator response was not \"OK\"")





More information about the tor-commits mailing list