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
Joanne Hugé
re6stnet
Commits
780bfbe3
Commit
780bfbe3
authored
Dec 22, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Faster recovery of registry node (e.g. restart or temporary network cut)
parent
f68cdf51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
re6st/tunnel.py
re6st/tunnel.py
+10
-5
No files found.
re6st/tunnel.py
View file @
780bfbe3
...
@@ -380,9 +380,14 @@ class TunnelManager(object):
...
@@ -380,9 +380,14 @@ class TunnelManager(object):
distant_peers
.
sort
(
key
=
self
.
_newTunnelScore
)
distant_peers
.
sort
(
key
=
self
.
_newTunnelScore
)
# Check whether we're connected to the network.
# Check whether we're connected to the network.
registry
=
self
.
peer_db
.
registry_prefix
registry
=
self
.
peer_db
.
registry_prefix
if
(
registry
==
self
.
_prefix
or
registry
in
peers
if
registry
==
self
.
_prefix
:
or
registry
in
self
.
_connection_dict
if
not
distant_peers
:
or
registry
in
self
.
_served
):
# Faster recovery of registry node: use cache instead
# of waiting that another node tries to connect to it.
distant_peers
=
None
elif
(
registry
in
peers
or
registry
in
self
.
_connection_dict
or
registry
in
self
.
_served
):
self
.
_disconnected
=
0
self
.
_disconnected
=
0
# Do not bootstrap too often, especially if we are several
# Do not bootstrap too often, especially if we are several
# nodes to try.
# nodes to try.
...
@@ -433,12 +438,12 @@ class TunnelManager(object):
...
@@ -433,12 +438,12 @@ class TunnelManager(object):
# The following condition on 'peers' is the same as above,
# The following condition on 'peers' is the same as above,
# when we asked the registry for a node to bootstrap.
# when we asked the registry for a node to bootstrap.
if
not
(
new
or
peers
):
if
not
(
new
or
peers
):
if
bootstrap
:
if
bootstrap
and
registry
!=
self
.
_prefix
:
# Startup without any good address in the cache.
# Startup without any good address in the cache.
peer
=
self
.
peer_db
.
getBootstrapPeer
()
peer
=
self
.
peer_db
.
getBootstrapPeer
()
if
peer
and
self
.
_makeTunnel
(
*
peer
):
if
peer
and
self
.
_makeTunnel
(
*
peer
):
return
return
# Failed to bootstrap ! Last chan
g
e to connect is to
# Failed to bootstrap ! Last chan
c
e to connect is to
# retry an address that already failed :(
# retry an address that already failed :(
for
peer
in
self
.
peer_db
.
getPeerList
(
1
):
for
peer
in
self
.
peer_db
.
getPeerList
(
1
):
if
self
.
_makeTunnel
(
*
peer
):
if
self
.
_makeTunnel
(
*
peer
):
...
...
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