Support custom chunk sizes on Connection#22
Support custom chunk sizes on Connection#22HaveFunTrading merged 3 commits intoHaveFunTrading:mainfrom
Conversation
|
Thanks for raising the PR. Will review later this week, probably ok to have chunk size configurable. Just bear in mind boomnet is not supposed to be used with blocking sockets. |
Yep! This is just to get it working on a macOS context.... probably should looking at setting up a proper linux dev environment |
src/http/mod.rs
Outdated
| } | ||
|
|
||
| #[inline] | ||
| pub fn is_disconnected(&self) -> bool { |
There was a problem hiding this comment.
can also be const and please add rustdocs
There was a problem hiding this comment.
Im of the opinion that this didn't need rustdocs, its pretty self documenting. I will add though
src/http/mod.rs
Outdated
| /// Represents an in-flight HTTP exchange. | ||
| pub struct HttpRequest<C: ConnectionPool> { | ||
| conn: Option<Connection<C::Stream>>, | ||
| pub struct HttpRequest<C: ConnectionPool<CHUNK_SIZE>, const CHUNK_SIZE: usize = 1024> { |
There was a problem hiding this comment.
let's introduce const DEFAULT_CHUNK_SIZE: usize = 1024 and replace hard coded default values
|
hi @arb000r looks good, only few minor comments to address |
|
done |
Wanted to provide own implementation for a connection pool with a custom CHUNK_SIZE. The motivation for this was to support local development on macOS. Attempting to
readinto a buffer with a capacity larger than the number of bytes available in the stream leads to blocking. (Stream non blocking set to false via socket config)Ancilliary changes:
Connection::newwas private, changed visibility, is this fine?disconnectedwas private, added a getter method for it, also fine?Main changes:
CHUNK_SIZEconst param onConnectionPoolwith a default to1024CHUNK_SIZECHUNK_SIZEtoHttpRequestExample: