Skip to content

Commit

Permalink
Fix check on return list of exitnodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rjruigrok committed Mar 26, 2015
1 parent 942347f commit 4c3478d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "Tribler/dispersy"]
path = Tribler/dispersy
url = https://github.com/tribler/dispersy.git
url = https://github.com/Tribler/dispersy.git
[submodule "Tribler/Core/DecentralizedTracking/pymdht"]
path = Tribler/Core/DecentralizedTracking/pymdht
url = https://github.com/LipuFei/pymdht.git
13 changes: 5 additions & 8 deletions Tribler/community/tunnel/tunnel_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def __init__(self, install_dir=None, tribler_session=None):

class ExitCandidate(object):

def __init__(self, connectable, become_exit):
self.connectable = connectable
def __init__(self, become_exit):
self.become_exit = become_exit
self.creation_time = time.time()

Expand Down Expand Up @@ -810,8 +809,7 @@ def on_introduction_request(self, messages):
super(TunnelCommunity, self).on_introduction_request(messages, extra_payload)
for message in messages:
pubkey = message.candidate.get_member().public_key
connectable = message.candidate.connection_type == u"public"
self.exit_candidates[pubkey] = ExitCandidate(message.payload.exitnode, connectable)
self.exit_candidates[pubkey] = ExitCandidate(message.payload.exitnode)

def create_introduction_request(self, destination, allow_sync, forward=True, is_fast_walker=False):
exitnode = self.settings.become_exitnode
Expand All @@ -822,8 +820,7 @@ def on_introduction_response(self, messages):
super(TunnelCommunity, self).on_introduction_response(messages)
for message in messages:
pubkey = message.candidate.get_member().public_key
connectable = message.candidate.connection_type == u"public"
self.exit_candidates[pubkey] = ExitCandidate(message.payload.exitnode, connectable)
self.exit_candidates[pubkey] = ExitCandidate(message.payload.exitnode)

def on_cell(self, messages):
for message in messages:
Expand Down Expand Up @@ -876,8 +873,8 @@ def on_create(self, messages):
for c in self.dispersy_yield_verified_candidates():
pubkey = c.get_member().public_key
exit_candidate = self.exit_candidates[pubkey]
if message.payload.exit_candidates and not exit_candidate.connectable:
# Next candidates need to be exit nodes, and this candidate isn't
if message.payload.exit_candidates and not (exit_candidate.become_exit and message.candidate.connection_type == u"public"):
# Next candidates need to be connectable exit nodes, and this candidate isn't
continue

candidates[pubkey] = c
Expand Down

0 comments on commit 4c3478d

Please sign in to comment.