[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Get polling interval from facilitator.
commit bc8f8370362167eb84fe2a1c59c998f92c105b33
Author: Alexandre Allaire <alexandre.allaire@xxxxxxxxxxxxxx>
Date: Thu Feb 7 18:43:22 2013 -0500
Get polling interval from facilitator.
Set the polling interval to be the value of the "check-back-in"
parameter from facilitator responses. If the polling interval received
is invalid, print an error message and keep polling at the previous
rate.
---
proxy/flashproxy.js | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
index 8cf086f..d44c2f1 100644
--- a/proxy/flashproxy.js
+++ b/proxy/flashproxy.js
@@ -549,10 +549,17 @@ function FlashProxy() {
var client_addr;
var relay_addr;
- setTimeout(this.proxy_main.bind(this), this.facilitator_poll_interval * 1000);
-
response = parse_query_string(text);
+ poll_interval = get_param_timespec(response, "check-back-in", this.facilitator_poll_interval);
+ if (poll_interval === null || poll_interval < MIN_FACILITATOR_POLL_INTERVAL)
+ puts("Error: polling interval from facilitator is not a nonnegative number at least " + repr(MIN_FACILITATOR_POLL_INTERVAL) + ".");
+ else
+ this.facilitator_poll_interval = poll_interval;
+ puts("Polling interval: " + repr(this.facilitator_poll_interval));
+
+ setTimeout(this.proxy_main.bind(this), this.facilitator_poll_interval * 1000);
+
if (!response.client) {
puts("No clients.");
return;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits