Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pymdht.get_peers returns unrelated peers #55

Open
gaohuazuo opened this issue May 23, 2015 · 0 comments
Open

Pymdht.get_peers returns unrelated peers #55

gaohuazuo opened this issue May 23, 2015 · 0 comments

Comments

@gaohuazuo
Copy link

Pymdht.get_peers returns too many peers for a non-existent info hash. This observation should be reproduced by the following code:

import sys
import logging

sys.path.append('')
from pymdht.core.pymdht import Pymdht as DHT
from pymdht.core.node import Node
from pymdht.plugins import lookup_a4
from pymdht.plugins import routing_nice_rtt
from pymdht.core import exp_plugin_template
from pymdht.core.identifier import Id

my_node = Node(['127.0.0.1', 12345])
conf_path = ''
private_dht_name = None
debug_level = logging.INFO
auto_bootstrap = True
bootstrap_mode = False
dht = DHT(my_node, conf_path, routing_nice_rtt, lookup_a4, exp_plugin_template,
          private_dht_name, debug_level, auto_bootstrap, bootstrap_mode)
info_hash = '1234567890123456789012345678901234567890'
peers = set()

def f(lookup_id, peer_list, node):
    if peer_list is None:
        print(peers)
        print(len(peers))
    else:
        for i in peer_list:
            peers.add(i)

dht.get_peers(None, Id(info_hash), f)

I get over 600 peers in the test, which is obviously too much for that info hash.
version 12.11.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant