Exemplo n.º 1
0
def construct_ping_response(data):
    n = neighbor.load_nodes()
    response = {}
    response['type'] = 'ping_response'
    response['neighbors'] = []
    for x in n:
        r = {}
        r['ip'] = x.ip
        r['port'] = x.port
        r['hash'] = x.hash
        response['neighbors'].append(r)
    print response
    return response
Exemplo n.º 2
0
def ping():
    neighbors = neighbor.load_nodes()
    for neigh in neighbors:
        ping_neighbor(neigh)
Exemplo n.º 3
0
def closest(sought):
    n = neighbor.load_nodes()
    return closest_neighbor(n, sought)