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

[CLOSED] Solve unnecessary state changes upon start #138

Closed
feross opened this issue Sep 21, 2014 · 1 comment
Closed

[CLOSED] Solve unnecessary state changes upon start #138

feross opened this issue Sep 21, 2014 · 1 comment

Comments

@feross
Copy link
Member

@feross feross commented Sep 21, 2014

Issue by marmolejo
Thursday Sep 11, 2014 at 11:35 GMT
Originally opened as https://github.com/feross/bittorrent-client/pull/42


When a torrent receives metadata, _onMetadata() is called. Then for each wire in the torrent, _onWireWithMetadata() sends the message "interested" to the peer, as it always starts like that. Later on the function calls _updateSelections(). As there is no selection yet, it now sends "not interested". After the function returns, _onMetadata() calls _onStorage() which selects the entire torrent, thus sending another "interested" message to the peer.

I'm not sure but probably it's not necessary to _updateSelections() in _onWireWithMetadata() as later on it will be called. However, _onWire() also calls it when a new wire in the torrent is being created with metadata.


marmolejo included the following code: https://github.com/feross/bittorrent-client/pull/42/commits

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Sep 21, 2014

Comment by feross
Wednesday Sep 17, 2014 at 04:38 GMT


Thanks - this looks good!

@feross feross closed this Sep 21, 2014
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.