Skip to content

Commit 3ff1827

Browse files
committed
fix: Allow multiple packs to be received one after another. (#972)
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.
1 parent c87f2cc commit 3ff1827

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gix/src/remote/connection/fetch/receive_pack.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,19 @@ where
281281
})),
282282
options,
283283
)?;
284+
// Assure the final flush packet is consumed.
285+
#[cfg(feature = "async-network-client")]
286+
let has_read_to_end = { rd.get_ref().stopped_at().is_some() };
287+
#[cfg(not(feature = "async-network-client"))]
288+
let has_read_to_end = { rd.stopped_at().is_some() };
289+
if !has_read_to_end {
290+
std::io::copy(&mut rd, &mut std::io::sink()).unwrap();
291+
}
284292
#[cfg(feature = "async-network-client")]
285293
{
286294
reader = rd.into_inner();
287295
}
296+
288297
#[cfg(not(feature = "async-network-client"))]
289298
{
290299
reader = rd;

0 commit comments

Comments
 (0)