1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

write buffer capacity for client

This commit is contained in:
Nikolay Kim
2018-03-09 10:09:13 -08:00
parent 2853086463
commit b56be8e571
3 changed files with 22 additions and 25 deletions

View File

@@ -28,7 +28,7 @@ pub struct ClientRequest {
upgrade: bool,
encoding: ContentEncoding,
response_decompress: bool,
buffer_capacity: Option<(usize, usize)>,
buffer_capacity: usize,
conn: ConnectionType,
}
@@ -51,7 +51,7 @@ impl Default for ClientRequest {
upgrade: false,
encoding: ContentEncoding::Auto,
response_decompress: true,
buffer_capacity: None,
buffer_capacity: 32_768,
conn: ConnectionType::Default,
}
}
@@ -179,7 +179,8 @@ impl ClientRequest {
self.response_decompress
}
pub fn buffer_capacity(&self) -> Option<(usize, usize)> {
/// Requested write buffer capacity
pub fn write_buffer_capacity(&self) -> usize {
self.buffer_capacity
}
@@ -466,12 +467,11 @@ impl ClientRequestBuilder {
}
/// Set write buffer capacity
pub fn buffer_capacity(&mut self,
low_watermark: usize,
high_watermark: usize) -> &mut Self
{
///
/// Default buffer capacity is 32kb
pub fn write_buffer_capacity(&mut self, cap: usize) -> &mut Self {
if let Some(parts) = parts(&mut self.request, &self.err) {
parts.buffer_capacity = Some((low_watermark, high_watermark));
parts.buffer_capacity = cap;
}
self
}