Skip to content

Commit 5c21ebc

Browse files
committed
fix: respect interrupt-requests during negotiation
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.
1 parent 466fe52 commit 5c21ebc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gix-protocol/src/fetch/function.rs

+5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ where
101101
let _round = gix_trace::detail!("negotiate round", round = rounds.len() + 1);
102102
progress.step();
103103
progress.set_name(format!("negotiate (round {})", rounds.len() + 1));
104+
if should_interrupt.load(Ordering::Relaxed) {
105+
return Err(Error::Negotiate(negotiate::Error::NegotiationFailed {
106+
rounds: rounds.len(),
107+
}));
108+
}
104109

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

0 commit comments

Comments
 (0)