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

Bencode object key ordering in Debug and macros #7

Closed
GGist opened this issue Jun 10, 2015 · 1 comment
Closed

Bencode object key ordering in Debug and macros #7

GGist opened this issue Jun 10, 2015 · 1 comment

Comments

@GGist
Copy link
Owner

GGist commented Jun 10, 2015

When we serialize a Bencode object we are explicitly sorting the keys before encoding them so that we follow the bencode specification.

Since then, we have derived Debug for Bencode and allowed Bencode building via macros. In the current design we do not sort or validate data coming or leaving from these two avenues respectively. We would have to sort and verify the sorting of dictionary keys every time we do a Debug print or build a Bencode object via macros. It will be significantly easier (and maybe more performant depending on our usage) if we just made the switch from a HashMap to a BTreeMap in Bencode::Dict.

@GGist
Copy link
Owner Author

GGist commented Jul 4, 2015

Since we have moved to using a BTreeMap as of #9 this is not longer an issue since keys are stored alphabetically.

@GGist GGist closed this as completed Jul 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant