Commit 55c85306 authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Ignore martians in `bt-bep5` program.

parent 2b4e600f
#include <bittorrent/dht.h>
#include <bittorrent/is_martian.h>
#include <bittorrent/routing_table.h>
#include <iostream>
......@@ -187,7 +188,14 @@ int main(int argc, const char** argv)
auto peers = [&] {
Progress p(ctx.get_executor(), "Getting peers");
return dht.tracker_get_peers(infohash, cancel, yield[ec]);
auto ps = dht.tracker_get_peers(infohash, cancel, yield[ec]);
// Remove martian endpoints (cant't use `remove_if` on sets).
for (auto it = ps.begin(); it != ps.end();)
if (is_martian(*it))
it = ps.erase(it);
else
it++;
return ps;
}();
if (!ec) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment