Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
re6stnet
Commits
896bc9de
Commit
896bc9de
authored
Oct 21, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registry: new RPC to get versions of all running nodes
parent
e9243962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
re6st/registry.py
re6st/registry.py
+39
-1
No files found.
re6st/registry.py
View file @
896bc9de
...
@@ -161,7 +161,7 @@ class RegistryServer(object):
...
@@ -161,7 +161,7 @@ class RegistryServer(object):
def
handle_request
(
self
,
request
,
method
,
kw
):
def
handle_request
(
self
,
request
,
method
,
kw
):
m
=
getattr
(
self
,
method
)
m
=
getattr
(
self
,
method
)
if
method
in
(
'topology'
,)
and
\
if
method
in
(
'
versions'
,
'
topology'
,)
and
\
request
.
client_address
[
0
]
not
in
(
'127.0.0.1'
,
'::1'
):
request
.
client_address
[
0
]
not
in
(
'127.0.0.1'
,
'::1'
):
return
request
.
send_error
(
httplib
.
FORBIDDEN
)
return
request
.
send_error
(
httplib
.
FORBIDDEN
)
key
=
m
.
getcallargs
(
**
kw
).
get
(
'cn'
)
key
=
m
.
getcallargs
(
**
kw
).
get
(
'cn'
)
...
@@ -369,6 +369,44 @@ class RegistryServer(object):
...
@@ -369,6 +369,44 @@ class RegistryServer(object):
logging
.
info
(
"Sending bootstrap peer: %s"
,
msg
)
logging
.
info
(
"Sending bootstrap peer: %s"
,
msg
)
return
utils
.
encrypt
(
cert
,
msg
)
return
utils
.
encrypt
(
cert
,
msg
)
@
rpc
def
versions
(
self
):
with
self
.
peers_lock
:
self
.
request_dump
()
peers
=
set
(
prefix
for
neigh_routes
in
self
.
ctl
.
neighbours
.
itervalues
()
for
prefix
in
neigh_routes
[
1
]
if
prefix
)
peers
.
add
(
self
.
prefix
)
peer_dict
=
{}
s
=
self
.
sock
,
with
self
.
lock
:
while
True
:
r
,
w
,
_
=
select
.
select
(
s
,
s
if
peers
else
(),
(),
3
)
if
r
:
ver
,
address
=
self
.
sock
.
recvfrom
(
1
<<
16
)
address
=
utils
.
binFromIp
(
address
[
0
])
if
(
address
.
startswith
(
self
.
network
)
and
len
(
ver
)
>
1
and
ver
[
0
]
in
'
\
3
\
4
'
# BBB
):
try
:
peer_dict
[
max
(
filter
(
address
[
len
(
self
.
network
):]
.
startswith
,
peer_dict
),
key
=
len
)]
=
ver
[
1
:]
except
ValueError
:
pass
if
w
:
x
=
peers
.
pop
()
peer_dict
[
x
]
=
None
x
=
utils
.
ipFromBin
(
self
.
network
+
x
)
try
:
self
.
sock
.
sendto
(
'
\
3
'
,
(
x
,
tunnel
.
PORT
))
except
socket
.
error
:
pass
elif
not
r
:
break
return
repr
(
peer_dict
)
@
rpc
@
rpc
def
topology
(
self
):
def
topology
(
self
):
with
self
.
lock
:
with
self
.
lock
:
...
...
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