Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
8de8ed08
Commit
8de8ed08
authored
Jan 13, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/net/swarm: dial timeout to 10s + dialer
parent
5b4a3c09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
p2p/net/swarm/swarm_dial.go
p2p/net/swarm/swarm_dial.go
+8
-1
No files found.
p2p/net/swarm/swarm_dial.go
View file @
8de8ed08
...
...
@@ -3,6 +3,7 @@ package swarm
import
(
"errors"
"fmt"
"net"
"sync"
"time"
...
...
@@ -13,6 +14,7 @@ import (
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
)
// dialAttempts governs how many times a goroutine will try to dial a given peer.
...
...
@@ -21,7 +23,7 @@ const dialAttempts = 3
// DialTimeout is the amount of time each dial attempt has. We can think about making
// this larger down the road, or putting more granular timeouts (i.e. within each
// subcomponent of Dial)
var
DialTimeout
time
.
Duration
=
time
.
Second
*
3
0
var
DialTimeout
time
.
Duration
=
time
.
Second
*
1
0
// dialsync is a small object that helps manage ongoing dials.
// this way, if we receive many simultaneous dial requests, one
...
...
@@ -185,6 +187,11 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
// open connection to peer
d
:=
&
conn
.
Dialer
{
Dialer
:
manet
.
Dialer
{
Dialer
:
net
.
Dialer
{
Timeout
:
DialTimeout
,
},
},
LocalPeer
:
s
.
local
,
LocalAddrs
:
localAddrs
,
PrivateKey
:
sk
,
...
...
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