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

Connect after listeners #23

Merged
merged 2 commits into from
Feb 21, 2015

Conversation

throughnothing
Copy link
Contributor

I'm opening this as an issue b/c I don't fully understand what the problem is yet. It seems like if you ever call .on('data', function(data){ ... }) before calling connect on the Socket() object, it will fail.

I've changed the test here to display the issue (it doesn't actually fail since the tests dont seem to item out, but it will hang when it hits the issue).

It seems just listening to the 'data' event causes something to be called that tries to do something on the socket connection that hasn't actually been created yet (since connect() hasn't been called). This pattern works on the vanilla node net package.

I PR'ed this on top of my other PR/branch (#22) b/c it was easier to exhibit the behavior after that change, but just look at the second commit on this PR for the issue.

throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 12, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 13, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 15, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 16, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 16, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 16, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 17, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 17, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 18, 2015
throughnothing added a commit to throughnothing/bitcore-p2p that referenced this pull request Feb 20, 2015
feross added a commit that referenced this pull request Feb 21, 2015
@feross feross merged commit 9aee784 into feross:master Feb 21, 2015
@throughnothing
Copy link
Contributor Author

Sorry @feross I should have made it clearer. I don't think this one should have been merged as it breaks your tests.

I was doing that to show the reproduced bug, but I wasn't sure about how to fix it.

feross added a commit that referenced this pull request Feb 21, 2015
@feross
Copy link
Owner

feross commented Feb 21, 2015

Figured this out. Fixed and released in 2.4.1.

@throughnothing
Copy link
Contributor Author

Awesome, thank you!

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