-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
88c84f7
to
bb33600
Compare
pausing here for sanity check review of structure. If this organization seems plausible, there are a couple additional tests that should go with it. |
* incoming connections post a channel event - fix libp2p#40 * inbound connections reduce the frequency of probes - address libp2p#35 waiting on libp2p/go-libp2p#747 for detecting local address changes
bb33600
to
1f8ed1d
Compare
…nat into feat/thread-cleanup
@aarshkshah1992 I merged your #51 into this branch in fe1f5df. A sanity check review before I merge this would be great :) |
@willscott Will take a look first thing tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo one unresolved design decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo couple of nits.
delay = AutoNATRetryInterval | ||
} | ||
timer := time.NewTimer(delay) | ||
timerRunning := true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer timer.Stop ?
private int | ||
public int | ||
pubaddr ma.Multiaddr | ||
if timerRunning && !timer.Stop() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the timer docs, just this should be fine:
if !t.Stop() {
<-t.C
}
We can then get rid of the timerRunning
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for timerRunning
is that if the timer fires above, then the channel will have already been drained. t.Stop()
on a fired timer will return false
, but in that code path we don't want to attempt to drain t.C
again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this.
…ibp2p/go-libp2p-0.5.2 Bump github.com/libp2p/go-libp2p from 0.5.1 to 0.5.2
waiting on libp2p/go-libp2p#747 for detecting local address changes