Commit 17d80ac6 authored by Ulysse Beaugnon's avatar Ulysse Beaugnon

A few bug solved

parent 4fc87945
......@@ -6,6 +6,11 @@ To be done :
find out who to have an automatic recovery without declare
Test the package
PB : at the beggining a node tries to find 10 other nodes so ask for 10 bootsrap nodes
This slow the beginning !!
When a node arrive it is in nobody DB => very slow beginning. It should advertise itself more
check the ips attributed
remove decalre
how do we make sure that none inject some false packets ?
......@@ -75,16 +75,15 @@ class PeerManager:
self.next_refresh = time.time() + self._refresh_time
return True
except socket.error, e:'Connection to server failed, re-bootstraping')
self.next_refresh = time.time() + self._refresh_time
except socket.error, e:
logging.debug('socket.error : %s' % e)'Connection to server failed, retrying in 30s')
self.next_refresh = time.time() + 30
return False
def _declare(self):
if self.address != None:
......@@ -120,8 +119,8 @@ class PeerManager:
except sqlite3.IntegrityError, e:
if e.args[0] != 'column prefix is not unique':
except:'Unable to bootstrap')
#except Exception, e:
#'Unable to bootstrap : %s' % e)
return False
def usePeer(self, prefix):
......@@ -185,7 +184,7 @@ class PeerManager:
return False
self._db.execute("""DELETE FROM peers WHERE used <= 0 ORDER BY used,
WHERE used <= 0) - ?)""", str(self._db_size))
self._db.execute("INSERT INTO peers (prefix, address) VALUES (?,?)", peer)
WHERE used <= 0) - ?)""", (str(self._db_size),))
self._db.execute("INSERT OR REPLACE INTO peers (prefix, address) VALUES (?,?)", peer)
logging.debug('Peer added')
return True
import os, traceback, time, subprocess, logging
import socket
import plib
import utils
# Be carfull the refresh interval should let the routes be established
......@@ -169,7 +170,7 @@ class TunnelManager:
peerIp[12:16], peerIp[16:20], peerIp[20:24], peerIp[24:28], peerIp[28:32])
logging.debug('Notifying peer %s' % ip)
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
sock.sendto('%s %s\n' % (self._prefix, self._peer_db.address), (ip, 326))
sock.sendto('%s %s\n' % (self._prefix, utils.address_str(self._peer_db.address)), (ip, 326))
except socket.error, e:
logging.debug('Unable to notify %s' % ip)
logging.debug('socket.error : %s' % e)
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