Algorithm-Kademlia

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

```python
# After getting a response from a FIND_NODE RPC:
$search->mark_responded($peer_id, @peers_from_rpc);
```

## `mark_failed( $id_bin )`

Marks a node as failed (e.g., RPC timeout).

```
# After a timeout or connection error:
$search->mark_failed($peer_id);
```

## `is_finished()`

Returns true if the search has reached a termination condition (either `k` nodes have responded, or there are no more
nodes to query and no pending requests).

```
while (!$search->is_finished) {

lib/Algorithm/Kademlia.pod  view on Meta::CPAN


Marks a node as having responded and adds any new peers it returned to the shortlist.

    # After getting a response from a FIND_NODE RPC:
    $search->mark_responded($peer_id, @peers_from_rpc);

=head2 C<mark_failed( $id_bin )>

Marks a node as failed (e.g., RPC timeout).

    # After a timeout or connection error:
    $search->mark_failed($peer_id);

=head2 C<is_finished()>

Returns true if the search has reached a termination condition (either C<k> nodes have responded, or there are no more
nodes to query and no pending requests).

    while (!$search->is_finished) {
        # ... keep querying ...
    }



( run in 0.739 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )