Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
17d80ac6
Commit
17d80ac6
authored
Aug 14, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few bug solved
parent
4fc87945
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
TODO
TODO
+5
-0
re6st/db.py
re6st/db.py
+5
-6
re6st/tunnel.py
re6st/tunnel.py
+2
-1
No files found.
TODO
View file @
17d80ac6
...
@@ -6,6 +6,11 @@ To be done :
...
@@ -6,6 +6,11 @@ To be done :
find out who to have an automatic recovery without declare
find out who to have an automatic recovery without declare
Test the package
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
check the ips attributed
remove decalre
remove decalre
how do we make sure that none inject some false packets ?
how do we make sure that none inject some false packets ?
...
...
re6st/db.py
View file @
17d80ac6
...
@@ -75,16 +75,15 @@ class PeerManager:
...
@@ -75,16 +75,15 @@ class PeerManager:
try
:
try
:
self
.
_declare
()
self
.
_declare
()
self
.
next_refresh
=
time
.
time
()
+
self
.
_refresh_time
self
.
next_refresh
=
time
.
time
()
+
self
.
_refresh_time
return
True
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
logging
.
info
(
'Connection to server failed, re-bootstraping'
)
logging
.
info
(
'Connection to server failed, re-bootstraping'
)
try
:
try
:
self
.
_bootstrap
()
self
.
_bootstrap
()
self
.
next_refresh
=
time
.
time
()
+
self
.
_refresh_time
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
logging
.
debug
(
'socket.error : %s'
%
e
)
logging
.
debug
(
'socket.error : %s'
%
e
)
logging
.
info
(
'Connection to server failed, retrying in 30s'
)
logging
.
info
(
'Connection to server failed, retrying in 30s'
)
self
.
next_refresh
=
time
.
time
()
+
30
self
.
next_refresh
=
time
.
time
()
+
30
return
False
def
_declare
(
self
):
def
_declare
(
self
):
if
self
.
address
!=
None
:
if
self
.
address
!=
None
:
...
@@ -120,8 +119,8 @@ class PeerManager:
...
@@ -120,8 +119,8 @@ class PeerManager:
except
sqlite3
.
IntegrityError
,
e
:
except
sqlite3
.
IntegrityError
,
e
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
raise
raise
except
:
#except Exception, e
:
logging
.
info
(
'Unable to bootstrap'
)
# logging.info('Unable to bootstrap : %s' % e
)
return
False
return
False
def
usePeer
(
self
,
prefix
):
def
usePeer
(
self
,
prefix
):
...
@@ -185,7 +184,7 @@ class PeerManager:
...
@@ -185,7 +184,7 @@ class PeerManager:
return
False
return
False
self
.
_db
.
execute
(
"""DELETE FROM peers WHERE used <= 0 ORDER BY used,
self
.
_db
.
execute
(
"""DELETE FROM peers WHERE used <= 0 ORDER BY used,
RANDOM() LIMIT MAX(0, (SELECT COUNT(*) FROM peers
RANDOM() LIMIT MAX(0, (SELECT COUNT(*) FROM peers
WHERE used <= 0) - ?)"""
,
str
(
self
.
_db_size
))
WHERE used <= 0) - ?)"""
,
(
str
(
self
.
_db_size
),
))
self
.
_db
.
execute
(
"INSERT INTO peers (prefix, address) VALUES (?,?)"
,
peer
)
self
.
_db
.
execute
(
"INSERT
OR REPLACE
INTO peers (prefix, address) VALUES (?,?)"
,
peer
)
logging
.
debug
(
'Peer added'
)
logging
.
debug
(
'Peer added'
)
return
True
return
True
re6st/tunnel.py
View file @
17d80ac6
import
os
,
traceback
,
time
,
subprocess
,
logging
import
os
,
traceback
,
time
,
subprocess
,
logging
import
socket
import
socket
import
plib
import
plib
import
utils
# Be carfull the refresh interval should let the routes be established
# Be carfull the refresh interval should let the routes be established
...
@@ -169,7 +170,7 @@ class TunnelManager:
...
@@ -169,7 +170,7 @@ class TunnelManager:
peerIp
[
12
:
16
],
peerIp
[
16
:
20
],
peerIp
[
20
:
24
],
peerIp
[
24
:
28
],
peerIp
[
28
:
32
])
peerIp
[
12
:
16
],
peerIp
[
16
:
20
],
peerIp
[
20
:
24
],
peerIp
[
24
:
28
],
peerIp
[
28
:
32
])
logging
.
debug
(
'Notifying peer %s'
%
ip
)
logging
.
debug
(
'Notifying peer %s'
%
ip
)
sock
=
socket
.
socket
(
socket
.
AF_INET6
,
socket
.
SOCK_DGRAM
)
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
:
except
socket
.
error
,
e
:
logging
.
debug
(
'Unable to notify %s'
%
ip
)
logging
.
debug
(
'Unable to notify %s'
%
ip
)
logging
.
debug
(
'socket.error : %s'
%
e
)
logging
.
debug
(
'socket.error : %s'
%
e
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment