Use read_exact instead of take & read_to_end

This commit is contained in:
Thinkofname 2016-03-23 23:28:33 +00:00
parent db22690dd1
commit 73646421d3
1 changed files with 2 additions and 2 deletions

View File

@ -760,8 +760,8 @@ impl Conn {
pub fn read_packet(&mut self) -> Result<packet::Packet, Error> {
let len = try!(VarInt::read_from(self)).0 as usize;
let mut ibuf = Vec::with_capacity(len);
try!(self.take(len as u64).read_to_end(&mut ibuf));
let mut ibuf = vec![0; len];
try!(self.read_exact(&mut ibuf));
let mut buf = io::Cursor::new(ibuf);