Skip to content
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

Merged
merged 1 commit into from
Sep 20, 2016
Merged

don't block on DiscoverHandler #115

merged 1 commit into from
Sep 20, 2016

Conversation

whyrusleeping
Copy link
Contributor

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.

Copy link
Contributor

@jbenet jbenet left a 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)
}
}()
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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)

@whyrusleeping whyrusleeping merged commit 494ade3 into master Sep 20, 2016
@whyrusleeping whyrusleeping removed the status/in-progress In progress label Sep 20, 2016
@whyrusleeping whyrusleeping deleted the feat/improve-mdns branch September 20, 2016 15:08
marten-seemann added a commit that referenced this pull request Dec 20, 2021
clean up dialer peerstore after each dial
marten-seemann pushed a commit that referenced this pull request Apr 21, 2022
return all dial errors if dial has failed
marten-seemann pushed a commit that referenced this pull request Apr 22, 2022
It _looks_ like the standard library doesn't always wrap this error.

fixes #113
marten-seemann added a commit that referenced this pull request Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants