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
9795a01b
Commit
9795a01b
authored
Oct 17, 2018
by
vyzo
Browse files
configurable boot delay for autorelay
parent
a5858912
Changes
1
Show whitespace changes
Inline
Side-by-side
p2p/host/relay/autorelay.go
View file @
9795a01b
...
...
@@ -19,7 +19,11 @@ import (
manet
"github.com/multiformats/go-multiaddr-net"
)
var
DesiredRelays
=
3
var
(
DesiredRelays
=
3
BootDelay
=
90
*
time
.
Second
)
// AutoRelayHost is a Host that uses relays for connectivity when a NAT is detected.
type
AutoRelayHost
struct
{
...
...
@@ -63,7 +67,7 @@ func (h *AutoRelayHost) hostAddrs(addrs []ma.Multiaddr) []ma.Multiaddr {
func
(
h
*
AutoRelayHost
)
background
(
ctx
context
.
Context
)
{
select
{
case
<-
time
.
After
(
autonat
.
AutoNATBootDelay
+
30
*
time
.
Second
)
:
case
<-
time
.
After
(
autonat
.
AutoNATBootDelay
+
BootDelay
)
:
case
<-
ctx
.
Done
()
:
return
}
...
...
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