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
3eac211e
Unverified
Commit
3eac211e
authored
Feb 27, 2020
by
Steven Allen
Committed by
GitHub
Feb 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #466 from libp2p/fix/timer-leak
fix(dialqueue): fix a timer leak
parents
4838fd5e
d4818f1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
dial_queue.go
dial_queue.go
+6
-0
No files found.
dial_queue.go
View file @
3eac211e
...
...
@@ -294,6 +294,7 @@ func (dq *dialQueue) worker() {
// This idle timer tracks if the environment is slow. If we're waiting to long to acquire a peer to dial,
// it means that the DHT query is progressing slow and we should shrink the worker pool.
idleTimer
:=
time
.
NewTimer
(
24
*
time
.
Hour
)
// placeholder init value which will be overridden immediately.
defer
idleTimer
.
Stop
()
for
{
// trap exit signals first.
select
{
...
...
@@ -308,6 +309,11 @@ func (dq *dialQueue) worker() {
select
{
case
<-
idleTimer
.
C
:
default
:
// NOTE: There is a slight race here. We could be in the
// middle of firing the timer and not read anything from the channel.
//
// However, that's not really a huge issue. We'll think
// we're idle but that's fine.
}
idleTimer
.
Reset
(
dq
.
config
.
maxIdle
)
...
...
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