fn recv_have(&mut self, query: Header, peer_id: PeerId, have: bool) {
        self.get_query(query.parent.unwrap(), |mgr, parent, mut state| {
            state.have.remove(&query.id);
            if state.block == Some(query.id) {
                state.block = None;
            }
            if have {
                state.providers.push(peer_id);
            }
            if state.block.is_none() && !state.providers.is_empty() {
                state.block = Some(mgr.block(
                    parent.root,
                    parent.id,
                    state.providers.pop().unwrap(),
                    query.cid,
                ));
            }
            if state.have.is_empty() && state.block.is_none() && state.providers.is_empty() {
                if state.providers.is_empty() {
                    return Transition::Complete(Err(query.cid));
                } else {
                    return Transition::Complete(Ok(()));
                }
            }
            Transition::Next(state)
        });
    }
/// Processes the response of a have query.
///
/// Marks the in progress query as complete and updates the set of peers that have
/// a block. If there isn't an in progress block query a new block query will be
/// started. If no block query can be started either a provider query is started or
/// the get query is marked as complete with a block-not-found error.
Processes the response of a have query.
Marks the in progress query as complete and updates the set of peers that have
a block. If there isn't an in progress block query a new block query will be
started. If no block query can be started either a provider query is started or
the get query is marked as complete with a block-not-found error.
Processes the response of a have query . Marks the in progress query as complete and updates the set of peers that have a block . If there isn ' t an in progress block query a new block query will be started . If no block query can be started either a provider query is started or the get query is marked as complete with a block - not - found error .
fn recv_have(&mut self, query: Header, peer_id: PeerId, have: bool) {
        self.get_query(query.parent.unwrap(), |mgr, parent, mut state| {
            state.have.remove(&query.id);
            if state.block == Some(query.id) {
                state.block = None;
            }
            if have {
                state.providers.push(peer_id);
            }
            if state.block.is_none() && !state.providers.is_empty() {
                state.block = Some(mgr.block(
                    parent.root,
                    parent.id,
                    state.providers.pop().unwrap(),
                    query.cid,
                ));
            }
            if state.have.is_empty() && state.block.is_none() && state.providers.is_empty() {
                if state.providers.is_empty() {
                    return Transition::Complete(Err(query.cid));
                } else {
                    return Transition::Complete(Ok(()));
                }
            }
            Transition::Next(state)
        });
    }
fn recv_have ( & mut self , query : Header , peer_id : PeerId , have : bool ) { self . get_query ( query . parent . unwrap ( ) , | mgr , parent , mut state | { state . have . remove ( & query . id ) ; if state . block == Some ( query . id ) { state . block = None ; } if have { state . providers . push ( peer_id ) ; } if state . block . is_none ( ) && ! state . providers . is_empty ( ) { state . block = Some ( mgr . block ( parent . root , parent . id , state . providers . pop ( ) . unwrap ( ) , query . cid , ) ) ; } if state . have . is_empty ( ) && state . block . is_none ( ) && state . providers . is_empty ( ) { if state . providers . is_empty ( ) { return Transition :: Complete ( Err ( query . cid ) ) ; } else { return Transition :: Complete ( Ok ( ( ) ) ) ; } } Transition :: Next ( state ) } ) ; }
Processes the response of a have query.
Processes the response of a have query .
&mut self
query
Header
peer_id
PeerId
have
bool
&mut self
query
Header
peer_id
PeerId
have
bool