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
p2p
go-p2p-kad-dht
Commits
356dcff8
Commit
356dcff8
authored
Jan 22, 2015
by
Juan Batiz-Benet
Committed by
Jeromy
Jan 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dont rate limit query during dials
parent
2c2de4d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
query.go
query.go
+5
-1
No files found.
query.go
View file @
356dcff8
...
...
@@ -223,6 +223,9 @@ func (r *dhtQueryRunner) queryPeer(cg ctxgroup.ContextGroup, p peer.ID) {
// make sure we're connected to the peer.
if
conns
:=
r
.
query
.
dht
.
host
.
Network
()
.
ConnsToPeer
(
p
);
len
(
conns
)
==
0
{
log
.
Infof
(
"not connected. dialing."
)
// while we dial, we do not take up a rate limit. this is to allow
// forward progress during potentially very high latency dials.
r
.
rateLimit
<-
struct
{}{}
pi
:=
peer
.
PeerInfo
{
ID
:
p
}
if
err
:=
r
.
query
.
dht
.
host
.
Connect
(
cg
.
Context
(),
pi
);
err
!=
nil
{
...
...
@@ -230,9 +233,10 @@ func (r *dhtQueryRunner) queryPeer(cg ctxgroup.ContextGroup, p peer.ID) {
r
.
Lock
()
r
.
errs
=
append
(
r
.
errs
,
err
)
r
.
Unlock
()
<-
r
.
rateLimit
// need to grab it again, as we deferred.
return
}
<-
r
.
rateLimit
// need to grab it again, as we deferred.
log
.
Debugf
(
"connected. dial success."
)
}
...
...
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