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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Boris Kocherov
re6stnet
Commits
1b272c71
Commit
1b272c71
authored
Apr 23, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More sanity check
parent
c231062f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
re6st/db.py
re6st/db.py
+12
-7
re6st/tunnel.py
re6st/tunnel.py
+5
-2
No files found.
re6st/db.py
View file @
1b272c71
...
...
@@ -84,15 +84,20 @@ class PeerDB(object):
logging
.
info
(
'Getting Boot peer...'
)
try
:
bootpeer
=
self
.
_proxy
.
getBootstrapPeer
(
self
.
_prefix
).
data
except
(
socket
.
error
,
xmlrpclib
.
Fault
),
e
:
p
=
subprocess
.
Popen
(
(
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
out
,
err
=
p
.
communicate
(
bootpeer
)
if
p
.
returncode
:
raise
subprocess
.
CalledProcessError
(
p
.
returncode
,
err
)
prefix
,
address
=
out
.
split
()
except
(
socket
.
error
,
xmlrpclib
.
Fault
,
subprocess
.
CalledProcessError
,
ValueError
),
e
:
logging
.
warning
(
'Failed to bootstrap (%s)'
,
e
)
else
:
p
=
subprocess
.
Popen
((
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
bootpeer
=
p
.
communicate
(
bootpeer
)[
0
].
split
()
if
bootpeer
[
0
]
!=
self
.
_prefix
:
self
.
addPeer
(
*
bootpeer
)
return
bootpeer
if
prefix
!=
self
.
_prefix
:
self
.
addPeer
(
prefix
,
address
)
return
prefix
,
address
logging
.
warning
(
'Buggy registry sent us our own address'
)
def
addPeer
(
self
,
prefix
,
address
,
set_preferred
=
False
):
...
...
re6st/tunnel.py
View file @
1b272c71
...
...
@@ -405,10 +405,13 @@ class TunnelManager(object):
return
code
=
ord
(
msg
[
0
])
if
code
==
1
:
# answer
# TODO: do not fail if message contains garbage
# We parse the message in a way to discard a truncated line.
for
peer
in
msg
[
1
:].
split
(
'
\
n
'
)[:
-
1
]:
try
:
prefix
,
address
=
peer
.
split
()
int
(
prefix
,
2
)
except
ValueError
:
break
if
prefix
!=
self
.
_prefix
:
self
.
_peer_db
.
addPeer
(
prefix
,
address
)
try
:
...
...
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