Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
67aba4d5
Commit
67aba4d5
authored
Oct 24, 2018
by
vyzo
Browse files
move relay selection strategy out of line
parent
cc2dd220
Changes
1
Show whitespace changes
Inline
Side-by-side
p2p/host/relay/autorelay.go
View file @
67aba4d5
...
...
@@ -132,9 +132,7 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) {
return
}
// TODO better relay selection strategy; this just selects random relays
// but we should probably use ping latency as the selection metric
shuffleRelays
(
pis
)
pis
=
h
.
selectRelays
(
pis
)
update
:=
0
...
...
@@ -171,6 +169,13 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) {
}
}
func
(
h
*
AutoRelayHost
)
selectRelays
(
pis
[]
pstore
.
PeerInfo
)
[]
pstore
.
PeerInfo
{
// TODO better relay selection strategy; this just selects random relays
// but we should probably use ping latency as the selection metric
shuffleRelays
(
pis
)
return
pis
}
func
(
h
*
AutoRelayHost
)
updateAddrs
()
{
h
.
doUpdateAddrs
()
h
.
PushIdentify
()
...
...
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