Skip to content

Commit

Permalink
Merge pull request #590 from benesch/copy-out-short-reads
Browse files Browse the repository at this point in the history
Don't accidentally return early from CopyOutReader
  • Loading branch information
sfackler authored Apr 1, 2020
2 parents 70ca1b4 + dd0c39e commit e3d3c6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgres/src/copy_out_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ impl Read for CopyOutReader<'_> {

impl BufRead for CopyOutReader<'_> {
fn fill_buf(&mut self) -> io::Result<&[u8]> {
if !self.cur.has_remaining() {
while !self.cur.has_remaining() {
let mut stream = self.stream.pinned();
match self
.connection
.block_on({ async { stream.next().await.transpose() } })
{
Ok(Some(cur)) => self.cur = cur,
Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)),
Ok(None) => {}
Ok(None) => break,
};
}

Expand Down

0 comments on commit e3d3c6d

Please sign in to comment.