Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
729c055f
Commit
729c055f
authored
Jul 16, 2017
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
scanner: fix reset and IPv6 print issue
parent
61f91d62
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/tools/scanner.py
+21
-14
21 additions, 14 deletions
python/tools/scanner.py
with
21 additions
and
14 deletions
python/tools/scanner.py
+
21
−
14
View file @
729c055f
...
...
@@ -48,6 +48,8 @@ cities=[]
xys
=
[]
colors
=
[]
all_lines
=
[]
points
=
[]
not_found
=
[]
plt
.
ion
()
plt
.
figaspect
(
2.
)
...
...
@@ -79,6 +81,10 @@ exitbtn = Button(exitax, 'Exit')
reloadax
=
plt
.
axes
([
0.92
,
0.90
,
0.07
,
0.04
])
button
=
Button
(
reloadax
,
'
Reload
'
)
collection
=
None
infos
=
[
ringx
.
text
(
1.2
,
-
0.8
,
""
),
ringx
.
text
(
1.2
,
-
0.9
,
""
)]
def
exitcb
(
arg
):
global
run
run
=
False
...
...
@@ -170,7 +176,7 @@ def appendNodes(nodes):
def
appendNewNode
(
n
):
global
nodes_ip4s
,
nodes_ip6s
,
colors
,
xys
addr
=
b
''
.
join
(
n
.
getNode
().
getAddr
().
split
(
b
'
:
'
)[
0
:
-
1
]).
decode
()
addr
=
b
'
:
'
.
join
(
n
.
getNode
().
getAddr
().
split
(
b
'
:
'
)[
0
:
-
1
]).
decode
()
colors
.
append
(
'
red
'
if
n
.
getNode
().
isExpired
()
else
'
blue
'
)
node_val
=
n
.
getId
().
toFloat
()
xys
.
append
((
cos
(
node_val
*
2
*
pi
),
sin
(
node_val
*
2
*
pi
)))
...
...
@@ -199,7 +205,7 @@ def appendMapPoint(res):
def
restart
(
arg
):
global
collection
,
all_lines
,
all_nodes
,
points
,
done
global
collection
,
all_lines
,
all_nodes
,
points
,
done
,
nodes_ip4s
,
nodes_ip6s
,
lats
,
lons
,
cities
,
xys
,
colors
if
done
:
return
for
l
in
all_lines
:
...
...
@@ -207,6 +213,13 @@ def restart(arg):
del
l
all_lines
=
[]
all_nodes
=
NodeSet
()
nodes_ip4s
=
{}
nodes_ip6s
=
{}
lats
=
[]
lons
=
[]
cities
=
[]
xys
=
[]
colors
=
[]
if
collection
:
collection
.
remove
()
del
collection
...
...
@@ -222,12 +235,6 @@ def restart(arg):
step
(
start_h
,
0
)
plt
.
draw
()
collection
=
None
points
=
[]
not_found
=
[]
infos
=
[
ringx
.
text
(
1.2
,
-
0.8
,
""
),
ringx
.
text
(
1.2
,
-
0.9
,
""
)]
def
num_nodes
(
node_set
):
return
sorted
([
x
for
x
in
node_set
.
items
()],
key
=
lambda
ip
:
ip
[
1
][
1
])
...
...
@@ -253,12 +260,6 @@ def update_plot():
infos
[
0
].
set_text
(
"
{} different IPv4s
"
.
format
(
len
(
nodes_ip4s
)))
infos
[
1
].
set_text
(
"
{} different IPv6s
"
.
format
(
len
(
nodes_ip6s
)))
if
run
:
# start first step
start_h
=
InfoHash
()
start_h
.
setBit
(
159
,
1
)
step
(
start_h
,
0
)
def
d
(
arg
):
pass
...
...
@@ -272,6 +273,12 @@ def handle_tasks():
break
;
update_plot
()
if
run
:
# start first step
start_h
=
InfoHash
()
start_h
.
setBit
(
159
,
1
)
step
(
start_h
,
0
)
while
run
:
while
run
and
done
>
0
:
handle_tasks
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment