Esempio n. 1
0
    identifier.RandomId(),
    identifier.Id('24f2446365d3ef782ec16ad63aea1206df4b8d21'),
    identifier.RandomId(),
    identifier.Id('a91af3cde492e29530754591b862b1beecab10ff'),
    identifier.RandomId(),
    identifier.Id('3119baecadea3f31bed00de5e7e76db5cfea7ca1'),
)

if len(sys.argv) == 4 and sys.argv[0] == 'server_dht.py':
    logging.critical('argv %r' % sys.argv)
    RUN_DHT = True
    my_addr = (sys.argv[1], int(sys.argv[2]))  #('192.16.125.242', 7000)
    logs_path = sys.argv[3]
    print 'logs_path:', logs_path
    logging_conf.setup(logs_path, logs_level)
    dht = kadtracker.KadTracker(my_addr, logs_path)
else:
    RUN_DHT = False
    print 'usage: python server_dht.py dht_ip dht_port path'

try:
    print 'Type Control-C to exit.'
    i = 0
    while (RUN_DHT):
        for info_hash in info_hashes:
            #splitted_heap_str = str(hp.heap()).split()
            #print i, splitted_heap_str[10]
            dht.print_routing_table_stats()
            time.sleep(2 * 60)
            print 'Getting peers:', time.time()
            dht.get_peers(info_hash, peers_found)
Esempio n. 2
0
 def setup(self):
     self.dht = kadtracker.KadTracker(tc.CLIENT_ADDR, '.')