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:
		| @@ -75,7 +75,7 @@ where | ||||
| #[derive(Clone, Debug)] | ||||
| pub struct Builder { | ||||
|     pub(super) exec: Exec, | ||||
|     h1_writev: bool, | ||||
|     h1_writev: Option<bool>, | ||||
|     h1_title_case_headers: bool, | ||||
|     h1_read_buf_exact_size: Option<usize>, | ||||
|     h1_max_buf_size: Option<usize>, | ||||
| @@ -424,7 +424,7 @@ impl Builder { | ||||
|     pub fn new() -> Builder { | ||||
|         Builder { | ||||
|             exec: Exec::Default, | ||||
|             h1_writev: true, | ||||
|             h1_writev: None, | ||||
|             h1_read_buf_exact_size: None, | ||||
|             h1_title_case_headers: false, | ||||
|             h1_max_buf_size: None, | ||||
| @@ -443,7 +443,7 @@ impl Builder { | ||||
|     } | ||||
|  | ||||
|     pub(super) fn h1_writev(&mut self, enabled: bool) -> &mut Builder { | ||||
|         self.h1_writev = enabled; | ||||
|         self.h1_writev = Some(enabled); | ||||
|         self | ||||
|     } | ||||
|  | ||||
| @@ -609,8 +609,12 @@ impl Builder { | ||||
|             let (tx, rx) = dispatch::channel(); | ||||
|             let proto = if !opts.http2 { | ||||
|                 let mut conn = proto::Conn::new(io); | ||||
|                 if !opts.h1_writev { | ||||
|                     conn.set_write_strategy_flatten(); | ||||
|                 if let Some(writev) = opts.h1_writev { | ||||
|                     if writev { | ||||
|                         conn.set_write_strategy_queue(); | ||||
|                     } else { | ||||
|                         conn.set_write_strategy_flatten(); | ||||
|                     } | ||||
|                 } | ||||
|                 if opts.h1_title_case_headers { | ||||
|                     conn.set_title_case_headers(); | ||||
|   | ||||
| @@ -964,7 +964,11 @@ impl Builder { | ||||
|     /// but may also improve performance when an IO transport doesn't | ||||
|     /// support vectored writes well, such as most TLS implementations. | ||||
|     /// | ||||
|     /// Default is `true`. | ||||
|     /// Setting this to true will force hyper to use queued strategy | ||||
|     /// which may eliminate unnecessary cloning on some TLS backends | ||||
|     /// | ||||
|     /// Default is `auto`. In this mode hyper will try to guess which | ||||
|     /// mode to use | ||||
|     pub fn http1_writev(&mut self, val: bool) -> &mut Self { | ||||
|         self.conn_builder.h1_writev(val); | ||||
|         self | ||||
|   | ||||
		Reference in New Issue
	
	Block a user