-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor the AutoRelay code #1240
Conversation
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.
just a small nit, other than that LGTM
evt := ev.(event.EvtPeerConnectednessChanged) | ||
switch evt.Connectedness { | ||
case network.Connected: | ||
// If we just connect to one of our static relays, get a reservation immediately. |
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.
this might make discovery strategy refactoring tricky, but i guess it is fine for now.
p2p/host/autorelay/autorelay.go
Outdated
if atomic.CompareAndSwapInt32(&ar.findRelaysRunning, 0, 1) { | ||
go func() { | ||
ar.findRelays(ctx) | ||
atomic.StoreInt32(&ar.findRelaysRunning, 0) |
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 this?
a92069d
to
46953c6
Compare
This refactor introduces 3 improvements:
EvtPeerConnectednessChanged
to detect disconnects from relays