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

Standardize hash variable names #374

Closed
feross opened this issue Jul 15, 2015 · 2 comments
Closed

Standardize hash variable names #374

feross opened this issue Jul 15, 2015 · 2 comments

Comments

@feross
Copy link
Member

@feross feross commented Jul 15, 2015

Right now, in most of the webtorrent modules, we use self.infoHash to store a buffer and self.infoHashHex to store a hex string. But there are a few places like lib/torrent.js where it's actually a hex string.

Same with self.peerId and self.peerIdHex.

We've already standardized on using hex strings at the edges of the various modules, i.e. events that emit infoHashes or peerIds always use hex strings. Functions that take an hash input always accept a hex string OR a buffer.

Let's go hex strings all the way, and make it so the self.infoHash property is always a hex string as well. And we can use self.infoHashBuffer for the buffer version. This will require changes to almost every module.

@imsnif

This comment has been minimized.

Copy link
Member

@imsnif imsnif commented Nov 29, 2015

Please let me know if I missed anything.

feross added a commit to webtorrent/parse-torrent-file that referenced this issue Dec 2, 2015
feross added a commit to webtorrent/magnet-uri that referenced this issue Dec 2, 2015
feross added a commit to webtorrent/torrent-discovery that referenced this issue Dec 2, 2015
feross added a commit to webtorrent/bittorrent-protocol that referenced this issue Dec 3, 2015
‘handshake’ event now emits infoHash and peerId as hex strings instead
of Buffers.

For webtorrent/webtorrent#374
@feross feross closed this in eaf085b Dec 4, 2015
feross added a commit that referenced this issue Dec 4, 2015
Standardize variable names (Fix #374)
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 5, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 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
2 participants
You can’t perform that action at this time.