Example #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
Example #2
0
def ping():
    neighbors = neighbor.load_nodes()
    for neigh in neighbors:
        ping_neighbor(neigh)
Example #3
0
def closest(sought):
    n = neighbor.load_nodes()
    return closest_neighbor(n, sought)