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
55c27e27
Commit
55c27e27
authored
Feb 21, 2015
by
Jeromy Johnson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #798 from jbenet/fix/goprocess-panic
fix weird race condition in goprocess that caused a few panics
parents
a0e5fc82
dfdf346b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
p2p/net/swarm/swarm_dial.go
p2p/net/swarm/swarm_dial.go
+4
-2
No files found.
p2p/net/swarm/swarm_dial.go
View file @
55c27e27
...
...
@@ -17,7 +17,6 @@ import (
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"
process
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
procctx
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
ratelimit
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/ratelimit"
)
...
...
@@ -384,7 +383,7 @@ func (s *Swarm) dialAddrs(ctx context.Context, d *conn.Dialer, p peer.ID, remote
// to end early.
go
func
()
{
// rate limiting just in case. at most 10 addrs at once.
limiter
:=
ratelimit
.
NewRateLimiter
(
proc
ctx
.
WithContext
(
ctx
),
10
)
limiter
:=
ratelimit
.
NewRateLimiter
(
proc
ess
.
Background
(
),
10
)
limiter
.
Go
(
func
(
worker
process
.
Process
)
{
// permute addrs so we try different sets first each time.
for
_
,
i
:=
range
rand
.
Perm
(
len
(
remoteAddrs
))
{
...
...
@@ -402,6 +401,9 @@ func (s *Swarm) dialAddrs(ctx context.Context, d *conn.Dialer, p peer.ID, remote
})
}
})
<-
ctx
.
Done
()
limiter
.
Close
()
}()
// wair fot the results.
...
...
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