Skip to content
Snippets Groups Projects
Commit 09ff99fa authored by Adrien Béraud's avatar Adrien Béraud
Browse files

scanner: handle search failure

parent eab69240
Branches
Tags
No related merge requests found
...@@ -114,20 +114,23 @@ def step(cur_h, cur_depth): ...@@ -114,20 +114,23 @@ def step(cur_h, cur_depth):
def nextstep(cur_h, cur_depth, ok, nodes, arc=None, lines=[]): def nextstep(cur_h, cur_depth, ok, nodes, arc=None, lines=[]):
global done, all_nodes global done, all_nodes
if arc: if nodes:
arc.remove() if arc:
del arc arc.remove()
for l in lines: del arc
l.set_color('#444444') for l in lines:
snodes = NodeSet() l.set_color('#444444')
snodes.extend(nodes) snodes = NodeSet()
all_nodes.extend(nodes) snodes.extend(nodes)
depth = min(6, InfoHash.commonBits(snodes.first(), snodes.last())+4) all_nodes.extend(nodes)
if cur_depth < depth: depth = min(6, InfoHash.commonBits(snodes.first(), snodes.last())+4)
for b in range(cur_depth, depth): if cur_depth < depth:
new_h = InfoHash(cur_h.toString()); for b in range(cur_depth, depth):
new_h.setBit(b, 1); new_h = InfoHash(cur_h.toString());
step(new_h, b+1); new_h.setBit(b, 1);
step(new_h, b+1);
else:
print("step done with no nodes", ok, cur_h.toString().decode())
done -= 1 done -= 1
run = True run = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment