diff --git a/src/network/stream_reader.rs b/src/network/stream_reader.rs index 3becfabc..6d07ef66 100644 --- a/src/network/stream_reader.rs +++ b/src/network/stream_reader.rs @@ -23,14 +23,14 @@ //! use core::fmt; -use io::Read; +use io::{Read, BufReader}; use consensus::{encode, Decodable}; /// Struct used to configure stream reader function pub struct StreamReader { /// Stream to read from - pub stream: R, + pub stream: BufReader, } impl fmt::Debug for StreamReader { @@ -44,7 +44,7 @@ impl StreamReader { #[deprecated(since="0.28.0", note="wrap you stream into a buffered reader if necessary and use consensus_encode directly")] pub fn new(stream: R, _buffer_size: Option) -> StreamReader { StreamReader { - stream, + stream: BufReader::new(stream), } }