Skip to content

Commit

Permalink
fix: Allow multiple packs to be received one after another. (#972)
Browse files Browse the repository at this point in the history
Previously it would be difficult to perform another fetch operation on the
same connection as the final flush packet after a pack wouldn't be consumed.

This has now been mitigated by consuming it in the one place where knoweldge
about this specialty exists.
  • Loading branch information
Byron committed Nov 12, 2023
1 parent c87f2cc commit 3ff1827
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gix/src/remote/connection/fetch/receive_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,19 @@ where
})),
options,
)?;
// Assure the final flush packet is consumed.
#[cfg(feature = "async-network-client")]
let has_read_to_end = { rd.get_ref().stopped_at().is_some() };
#[cfg(not(feature = "async-network-client"))]
let has_read_to_end = { rd.stopped_at().is_some() };
if !has_read_to_end {
std::io::copy(&mut rd, &mut std::io::sink()).unwrap();
}
#[cfg(feature = "async-network-client")]
{
reader = rd.into_inner();
}

#[cfg(not(feature = "async-network-client"))]
{
reader = rd;
Expand Down

0 comments on commit 3ff1827

Please sign in to comment.