Skip to content

Conversation

@tomaka
Copy link
Member

@tomaka tomaka commented Jan 9, 2018

No description provided.

Copy link
Contributor

@eira-fransham eira-fransham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo and a possibly-inaccurate TODO

}
},
VarintCodecInner::Poisonned => {
panic!("Poisonned decoder")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, and maybe "Varint codec was poisoned" would be more descriptive.

type Error = io::Error;

fn encode(&mut self, item: D, dst: &mut BytesMut) -> Result<(), io::Error> {
let encoded_len = encode(item.as_ref().len()); // TODO: can be optimized by not allocating?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this allocate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encode returns a Vec<u8>, while we could directly write the length to dst.

@tomaka tomaka merged commit 0534076 into libp2p:master Jan 15, 2018
@tomaka tomaka deleted the varint-codec branch January 15, 2018 14:08
dkuehr pushed a commit to openmina/rust-libp2p that referenced this pull request Oct 24, 2023
Ask `get_some_initial_peers` RPC and choose peers from the list
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