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
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
e9ee29f6
Commit
e9ee29f6
authored
May 17, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logs
parent
e0917607
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
re6st/registry.py
re6st/registry.py
+11
-1
No files found.
re6st/registry.py
View file @
e9ee29f6
...
...
@@ -609,6 +609,7 @@ class RegistryServer:
return
zlib
.
compress
(
json
.
dumps
(
config
).
encode
(
"utf-8"
))
def
_queryAddress
(
self
,
peer
):
logging
.
info
(
"Querying address for %s/%s"
,
int
(
peer
,
2
),
len
(
peer
))
self
.
sendto
(
peer
,
1
)
s
=
self
.
sock
,
timeout
=
3
...
...
@@ -616,6 +617,7 @@ class RegistryServer:
# Loop because there may be answers from previous requests.
while
select
.
select
(
s
,
(),
(),
timeout
)[
0
]:
prefix
,
msg
=
self
.
recv
(
1
)
logging
.
info
(
"* received: %s - %s"
,
prefix
,
msg
)
if
prefix
==
peer
:
return
msg
timeout
=
max
(
0
,
end
-
time
.
time
())
...
...
@@ -629,6 +631,7 @@ class RegistryServer:
@
rpc
def
getBootstrapPeer
(
self
,
cn
):
logging
.
info
(
"Answering bootstrap peer for %s"
,
cn
)
with
self
.
peers_lock
:
age
,
peers
=
self
.
peers
if
age
<
time
.
time
()
or
not
peers
:
...
...
@@ -640,6 +643,7 @@ class RegistryServer:
peers
.
append
(
self
.
prefix
)
random
.
shuffle
(
peers
)
self
.
peers
=
time
.
time
()
+
60
,
peers
logging
.
debug
(
"peers: %r"
,
peers
)
peer
=
peers
.
pop
()
if
peer
==
cn
:
# Very unlikely (e.g. peer restarted with empty cache),
...
...
@@ -649,6 +653,7 @@ class RegistryServer:
with
self
.
lock
:
msg
=
self
.
_queryAddress
(
peer
)
if
msg
is
None
:
logging
.
info
(
"No address for %s, returning None"
,
peer
)
return
# Remove country for old nodes
if
self
.
getPeerProtocol
(
cn
)
<
7
:
...
...
@@ -778,6 +783,7 @@ class RegistryServer:
@
rpc_private
def
topology
(
self
):
logging
.
info
(
"Computing topology"
)
p
=
lambda
p
:
'%s/%s'
%
(
int
(
p
,
2
),
len
(
p
))
peers
=
deque
((
p
(
self
.
prefix
),))
graph
=
defaultdict
(
set
)
...
...
@@ -787,6 +793,7 @@ class RegistryServer:
r
,
w
,
_
=
select
.
select
(
s
,
s
if
peers
else
(),
(),
3
)
if
r
:
prefix
,
x
=
self
.
recv
(
5
)
logging
.
info
(
"Received %s %s"
,
prefix
,
x
)
if
prefix
and
x
:
prefix
=
p
(
prefix
)
x
=
x
.
split
()
...
...
@@ -801,8 +808,11 @@ class RegistryServer:
graph
[
x
].
add
(
prefix
)
graph
[
''
].
add
(
prefix
)
if
w
:
self
.
sendto
(
utils
.
binFromSubnet
(
peers
.
popleft
()),
5
)
first
=
peers
.
popleft
()
logging
.
info
(
"Sending %s"
,
first
)
self
.
sendto
(
utils
.
binFromSubnet
(
first
),
5
)
elif
not
r
:
logging
.
info
(
"No more sockets, stopping"
)
break
return
json
.
dumps
({
k
:
list
(
v
)
for
k
,
v
in
graph
.
items
()})
...
...
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