Skip to content

Commit

Permalink
fix: respect interrupt-requests during negotiation
Browse files Browse the repository at this point in the history
It is possible for the negotiation to go on forever if implemented incorrectly
on the client side. Hence it's useful to gracefully interrupt it.
  • Loading branch information
Byron committed Dec 20, 2024
1 parent 466fe52 commit 5c21ebc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gix-protocol/src/fetch/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ where
let _round = gix_trace::detail!("negotiate round", round = rounds.len() + 1);
progress.step();
progress.set_name(format!("negotiate (round {})", rounds.len() + 1));
if should_interrupt.load(Ordering::Relaxed) {
return Err(Error::Negotiate(negotiate::Error::NegotiationFailed {
rounds: rounds.len(),
}));
}

let is_done = match negotiate.one_round(&mut state, &mut arguments, previous_response.as_ref()) {
Ok((round, is_done)) => {
Expand Down

0 comments on commit 5c21ebc

Please sign in to comment.