Commit 9e65bddd authored by Guillaume Bury's avatar Guillaume Bury

Fix in the refresh dead peers in registry + added info about hello interval

parent 4e4830ea
...@@ -135,6 +135,9 @@ OPTIONS : VIFIBNET.PY ...@@ -135,6 +135,9 @@ OPTIONS : VIFIBNET.PY
to : to :
-h duration -H duration -h duration -H duration
in babeld ( for more information, see babeld man page ) in babeld ( for more information, see babeld man page )
It takes between 3 times and 4 times the hello interval for babel
to re-establish connection with a node for which the direct
connection has been cut
Default : 30 Default : 30
-w, --wireless -w, --wireless
......
...@@ -49,6 +49,8 @@ To be discussed: ...@@ -49,6 +49,8 @@ To be discussed:
Btw, is there a doc ( pdf, image, file ) resuming Raphael's stats Btw, is there a doc ( pdf, image, file ) resuming Raphael's stats
on nexedi's server downtime ? it could be useful for the internship on nexedi's server downtime ? it could be useful for the internship
rapport rapport
==> It takes babel between 3 times and 4 times the hello interval to
reestablish connection, if a direct link is cut
G : I think the number of route going through an interface should be a G : I think the number of route going through an interface should be a
Connection attribute, not a dict in tunnelManager Connection attribute, not a dict in tunnelManager
......
...@@ -3,7 +3,6 @@ import argparse, math, random, select, smtplib, sqlite3, string, socket, time, t ...@@ -3,7 +3,6 @@ import argparse, math, random, select, smtplib, sqlite3, string, socket, time, t
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
from email.mime.text import MIMEText from email.mime.text import MIMEText
from OpenSSL import crypto from OpenSSL import crypto
from time import time
import utils import utils
# To generate server ca and key with serial for 2001:db8:42::/48 # To generate server ca and key with serial for 2001:db8:42::/48
...@@ -35,7 +34,7 @@ class main(object): ...@@ -35,7 +34,7 @@ class main(object):
self.cert_duration = 365 * 86400 self.cert_duration = 365 * 86400
self.time_out = 86400 self.time_out = 86400
self.refresh_interval = 600 self.refresh_interval = 600
self.last_refresh = time() self.last_refresh = time.time()
# Command line parsing # Command line parsing
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
...@@ -198,10 +197,10 @@ class main(object): ...@@ -198,10 +197,10 @@ class main(object):
assert 0 < n < 1000 assert 0 < n < 1000
client_ip = utils.binFromIp(client_address) client_ip = utils.binFromIp(client_address)
if client_ip.startswith(self.network): if client_ip.startswith(self.network):
if time() > self.last_refresh + self.refresh_interval: if time.time() > self.last_refresh + self.refresh_interval:
print "refreshing peers for dead ones" print "refreshing peers for dead ones"
self.db.execute("DELETE FROM peers WHERE ( date + ? ) <= CAST (strftime('%s', 'now') AS INTEGER)", (self.time_out,)) self.db.execute("DELETE FROM peers WHERE ( date + ? ) <= CAST (strftime('%s', 'now') AS INTEGER)", (self.time_out,))
self.last_refesh = time() self.last_refesh = time.time()
print "sending peers" print "sending peers"
return self.db.execute("SELECT prefix, address FROM peers ORDER BY random() LIMIT ?", (n,)).fetchall() return self.db.execute("SELECT prefix, address FROM peers ORDER BY random() LIMIT ?", (n,)).fetchall()
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment