-
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
don't block on DiscoverHandler #115
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.
Need to:
- move the chan and goroutine creation back to the for loop
for entry := range entriesCh { | ||
m.handleEntry(entry) | ||
} | ||
}() |
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 is incorrect-- how does it pass tests?
this chan creation and goroutine is here because there may be mdns.Query
errors for a single peer. the way you moved it out to the top of pollForEntries
will make it so that it will close the chan exit after the first error-- and it may even call close(entriesCh)
multiple times (!!!).
move the chan creation + goroutine back to within the for loop.
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.
Oh yeah... I was wondering where we closed that
@@ -159,7 +164,7 @@ func (m *mdnsService) handleEntry(e *mdns.ServiceEntry) { | |||
|
|||
m.lk.Lock() | |||
for _, n := range m.notifees { | |||
n.HandlePeerFound(pi) | |||
go n.HandlePeerFound(pi) |
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.
it looks like this is the only thing this changeset should change. (plus the logs)
b1273e9
to
e6a5c5c
Compare
clean up dialer peerstore after each dial
return all dial errors if dial has failed
It _looks_ like the standard library doesn't always wrap this error. fixes #113
add support for wss dialing
The current code runs the
Connect
calls for each peer discovered over mdns in the same goroutine. If a connect call starts to hang, then it gums up the entire mdns discovery process.