Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
55c85306
Commit
55c85306
authored
Jan 07, 2021
by
Ivan Vilata-i-Balaguer
Browse files
Ignore martians in `bt-bep5` program.
parent
2b4e600f
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/bt-bep5.cpp
View file @
55c85306
#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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment