Skip to content

Commit

Permalink
Merge pull request #865 from benemorius/fix-add-knownnodes-call
Browse files Browse the repository at this point in the history
fix/remove incorrect add_known_node() call
  • Loading branch information
Renelvon committed Oct 27, 2014
2 parents c96fc4c + ba20ece commit 288438d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions node/dht.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def start(self, seed_peer):
"""
ip = seed_peer.ip
port = seed_peer.port
self.add_known_node(('tcp://%s:%s' % (ip, port), seed_peer.guid, seed_peer.nickname))
self._add_known_node(('tcp://%s:%s' % (ip, port), seed_peer.guid, seed_peer.nickname))

self.log.debug('Starting Seed Peer: %s', seed_peer.nickname)
self.add_peer(self.transport,
Expand Down Expand Up @@ -128,7 +128,7 @@ def add_peer(self, transport, uri, pubkey=None, guid=None, nickname=None):
self.log.debug("This peer is already known and up to date")
return
else:
self.add_known_node(peer_tuple)
self._add_known_node(peer_tuple)

self.log.info(
'New peer seen; starting handshake - %s %s %s',
Expand All @@ -144,7 +144,7 @@ def cb():
t = Thread(target=new_peer.start_handshake, args=(cb,))
t.start()

def add_known_node(self, node):
def _add_known_node(self, node):
""" Accept a peer tuple and add it to known nodes list
:param node: (tuple)
:return: N/A
Expand Down
4 changes: 0 additions & 4 deletions node/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
from threading import Thread
import traceback
from urlparse import urlparse
import xmlrpclib

import gnupg
Expand Down Expand Up @@ -471,12 +470,9 @@ def _on_message(self, msg):

pubkey = msg.get('pubkey')
uri = msg.get('uri')
ip = urlparse(uri).hostname
port = urlparse(uri).port
guid = msg.get('senderGUID')
nickname = msg.get('senderNick')[:120]

self.dht.add_known_node((ip, port, guid, nickname))
self.log.info('On Message: %s', json.dumps(msg, ensure_ascii=False))
self.dht.add_peer(self, uri, pubkey, guid, nickname)
t = Thread(target=self.trigger_callbacks, args=(msg['type'], msg,))
Expand Down

0 comments on commit 288438d

Please sign in to comment.