示例#1
0
def init(addr, conf_path):
    if DEBUG:
        log_level = logging.DEBUG
    else:
        log_level = logging.ERROR
    logger.debug(u"DHT initialization %s", DHT_IMPORTED)

    if DHT_IMPORTED:
        my_node = node.Node(addr, None, version=pymdht.VERSION_LABEL)
        private_dht_name = None
        dht = pymdht.Pymdht(my_node, conf_path, routing_mod, lookup_mod,
                            experimental_m_mod, private_dht_name, log_level)
        logger.debug(u"DHT running")
        return dht
示例#2
0
def init(addr, conf_path):
    global dht
    global dht_imported
    
    if DEBUG:
        print >>sys.stderr,'dht: DHT initialization', dht_imported
        log_level = logging.DEBUG
    else:
        log_level = logging.ERROR
    if dht_imported and dht is None:
        my_node = node.Node(addr, None, version=pymdht.VERSION_LABEL)
        private_dht_name = None
        dht = pymdht.Pymdht(my_node, conf_path,
                            routing_mod,
                            lookup_mod,
                            experimental_m_mod,
                            private_dht_name,
                            log_level,
                            swift_port=SWIFT_PORT)
        if DEBUG:
            print >>sys.stderr,'dht: DHT running'