From 3599d50811a629b332aacafca594300eb16f3df0 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Wed, 17 Jul 2019 23:01:26 -0700 Subject: [PATCH] Use advance instead of set in read loop --- sqlx-postgres/src/connection/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlx-postgres/src/connection/mod.rs b/sqlx-postgres/src/connection/mod.rs index ad347242..8d21ccfb 100644 --- a/sqlx-postgres/src/connection/mod.rs +++ b/sqlx-postgres/src/connection/mod.rs @@ -110,8 +110,8 @@ impl Connection { let n = self.stream.read(unsafe { self.rbuf.bytes_mut() }).await?; // SAFE: After we read in N bytes, we can tell the buffer that it actually - // has that many bytes for the decode routines to look at - unsafe { self.rbuf.set_len(n) } + // has that many bytes MORE for the decode routines to look at + unsafe { self.rbuf.advance_mut(n) } if n == 0 { self.stream_eof = true;