feat(lib): Setting http1_writev(true) will now force writev queue usage

Previously, calling `http1_writev(true)` would just keep the default behavior, which was to auto detect if writev was optimal. Now, the auto-detection is still default, but explicitly calling `http1_writev(true)` will skip the auto-detection, and always use writev queue strategy.

Closes #2282
This commit is contained in:
Snarpix
2020-09-18 19:50:43 +03:00
committed by GitHub
parent 1edf2af377
commit 187c22afb5
6 changed files with 44 additions and 13 deletions

View File

@@ -94,6 +94,13 @@ where
self.write_buf.set_strategy(WriteStrategy::Flatten);
}
pub fn set_write_strategy_queue(&mut self) {
// this should always be called only at construction time,
// so this assert is here to catch myself
debug_assert!(self.write_buf.queue.bufs_cnt() == 0);
self.write_buf.set_strategy(WriteStrategy::Queue);
}
pub fn read_buf(&self) -> &[u8] {
self.read_buf.as_ref()
}