src/protocol.cpp
/*
     * Pick a closest nodes to key from bucket, send asynchronous FIND_NODE rpcs to each.
     */
Pick a closest nodes to key from bucket, send asynchronous FIND_NODE rpcs to each.
Pick a closest nodes to key from bucket send asynchronous FIND_NODE rpcs to each .
void Protocol::node_lookup(mp::uint256_t key, GetCallback callback, bool findValue, bool store) {
        std::vector<NodeInfo> a_closest_nodes = routingTable.getAClosestNodes(ALPHA, key);
        RequestState request_state;
        request_state.key = key;
        request_state.findValue = findValue;
        request_state.store = store;
        request_state.callback = callback;
        for(NodeInfo node : a_closest_nodes) {
            NodeInfoWrapper node_wrapper(key, node);
            request_state.k_closest_nodes.insert(node_wrapper);
            request_state.responses_waiting++;
            if (request_state.findValue) {
                network->send_find_value(key, node);
            } else {
                network->send_find_node(key, node);
            }
        }
        lookups[key] = request_state;
    }
void Protocol :: node_lookup ( mp :: uint256_t key , GetCallback callback , bool findValue , bool store ) { std :: vector < NodeInfo > a_closest_nodes = routingTable . getAClosestNodes ( ALPHA , key ) ; RequestState request_state ; request_state . key = key ; request_state . findValue = findValue ; request_state . store = store ; request_state . callback = callback ; for ( NodeInfo node : a_closest_nodes ) { NodeInfoWrapper node_wrapper ( key , node ) ; request_state . k_closest_nodes . insert ( node_wrapper ) ; request_state . responses_waiting ++ ; if ( request_state . findValue ) { network -> send_find_value ( key , node ) ; } else { network -> send_find_node ( key , node ) ; } } lookups [ key ] = request_state ; }
Pick a closest nodes to key from bucket, send asynchronous FIND_NODE rpcs to each.
Pick a closest nodes to key from bucket send asynchronous FIND_NODE rpcs to each .