From 9ca384f9da2023fc96bd973e32fed7136ef9dd4c Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Thu, 5 Apr 2018 20:16:37 -0400 Subject: [PATCH] streamline loop_server stream construction --- src/bin/loop_server.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bin/loop_server.rs b/src/bin/loop_server.rs index 4467d48..cdfca0e 100644 --- a/src/bin/loop_server.rs +++ b/src/bin/loop_server.rs @@ -6,7 +6,6 @@ use std::env::args; use std::net::ToSocketAddrs; use futures::future::FutureResult; -use futures::stream::once; use futures::stream::repeat; use futures::stream::Stream; use lab_ebml::chunk::{Chunk, WebmStream, ChunkingError}; @@ -32,11 +31,8 @@ impl Service for WebmServer { let response = match (req.method(), req.path()) { (&Get, "/loop") => { let stream: BodyStream> = Box::new( - repeat(()).take(3) - .map(|()| { - once::<&[u8], ()>(Ok(SRC_FILE)).parse_ebml().chunk_webm() - }).flatten() - .fix_timecodes() + repeat::<&[u8], ()>(SRC_FILE).take(5) + .parse_ebml().chunk_webm().fix_timecodes() .map_err(|err| match err { ChunkingError::IoError(io_err) => hyper::Error::Io(io_err), ChunkingError::OtherError(_) => hyper::Error::Incomplete