add a little documentation re: soft buffer limits

This commit is contained in:
Tangent 128 2018-04-16 01:58:28 -04:00
parent 32cf6dd2ef
commit 0e370556a2
3 changed files with 10 additions and 4 deletions

View File

@ -96,7 +96,10 @@ pub struct WebmChunker<S> {
}
impl<S> WebmChunker<S> {
pub fn with_buffer_limit(mut self, limit: usize) -> Self {
/// add a "soft" buffer size limit; if a chunk buffer exceeds this size,
/// error the stream instead of resuming. It's still possible for a buffer
/// to exceed this size *after* a write, so ensure input sizes are reasonable.
pub fn with_soft_limit(mut self, limit: usize) -> Self {
self.buffer_size_limit = Some(limit);
self
}

View File

@ -64,8 +64,8 @@ impl RelayServer {
where S::Error: Error + Send {
let source = stream
.map_err(WebmetroError::from_err)
.parse_ebml().with_buffer_limit(BUFFER_LIMIT)
.chunk_webm().with_buffer_limit(BUFFER_LIMIT);
.parse_ebml().with_soft_limit(BUFFER_LIMIT)
.chunk_webm().with_soft_limit(BUFFER_LIMIT);
let sink = Transmitter::new(self.get_channel());
Box::new(

View File

@ -15,7 +15,10 @@ pub struct EbmlStreamingParser<S> {
}
impl<S> EbmlStreamingParser<S> {
pub fn with_buffer_limit(mut self, limit: usize) -> Self {
/// add a "soft" buffer size limit; if the input buffer exceeds this size,
/// error the stream instead of resuming. It's still possible for the buffer
/// to exceed this size *after* a fill, so ensure input sizes are reasonable.
pub fn with_soft_limit(mut self, limit: usize) -> Self {
self.buffer_size_limit = Some(limit);
self
}