commit 28b0408f9f62405c28f59f56cd1df59d07998142
Author: Alexandre Allaire <alexandre.allaire(a)mail.mcgill.ca>
Date: Thu Feb 7 18:05:33 2013 -0500
Send polling interval to proxies.
Include a check "CHECK-BACK-IN" parameter in response to proxy requests,
that specifies when the proxy should contact the facilitator again.
Currently this value is hard coded.
---
facilitator/facilitator | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/facilitator/facilitator b/facilitator/facilitator
index 0fa33e9..715ddec 100755
--- a/facilitator/facilitator
+++ b/facilitator/facilitator
@@ -16,6 +16,9 @@ DEFAULT_LISTEN_PORT = 9002
DEFAULT_RELAY_PORT = 9001
DEFAULT_LOG_FILENAME = "facilitator.log"
+# Tell proxies to poll for clients every POLL_INTERVAL seconds.
+POLL_INTERVAL = 600
+
# Don't indulge clients for more than this many seconds.
CLIENT_TIMEOUT = 1.0
# Buffer no more than this many bytes when trying to read a line.
@@ -255,10 +258,10 @@ class Handler(SocketServer.StreamRequestHandler):
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))
+ print >> self.wfile, fac.render_transaction("OK", ("CLIENT", str(reg)), ("RELAY", options.relay_spec), ("CHECK-BACK-IN", str(POLL_INTERVAL)))
else:
log(u"proxy gets none")
- print >> self.wfile, fac.render_transaction("NONE")
+ print >> self.wfile, fac.render_transaction("NONE", ("CHECK-BACK-IN", str(POLL_INTERVAL)))
return True
def do_PUT(self, params):