fetch: re-work transport::done signal call
The protocol requires that the fetcher signals to the remote that it is done with the fetching process, so that the remote can exit out of its upload-pack process. The first change is that the `done` signal can happen before the validation, since nothing else needs to be fetched. The second change is that the fetcher does not care if the remote responds to this signal since it has the data required for validation and applying the changes to its refdb. Thus, if an error is encountered then it is logged, but the rest of the process proceeds as normal. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
c02ff1e47e
commit
b1435629f9
|
|
@ -9,18 +9,19 @@ mod refs;
|
||||||
mod stage;
|
mod stage;
|
||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
use gix_protocol::handshake;
|
|
||||||
pub use handle::Handle;
|
|
||||||
pub use policy::{Allowed, BlockList, Scope};
|
|
||||||
use radicle::storage::ReadRepository as _;
|
|
||||||
pub use state::{FetchLimit, FetchResult};
|
|
||||||
pub use transport::Transport;
|
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use gix_protocol::handshake;
|
||||||
|
|
||||||
|
pub use handle::Handle;
|
||||||
|
pub use policy::{Allowed, BlockList, Scope};
|
||||||
|
pub use state::{FetchLimit, FetchResult};
|
||||||
|
pub use transport::Transport;
|
||||||
|
|
||||||
use radicle::crypto::PublicKey;
|
use radicle::crypto::PublicKey;
|
||||||
use radicle::storage::refs::RefsAt;
|
use radicle::storage::refs::RefsAt;
|
||||||
|
use radicle::storage::ReadRepository as _;
|
||||||
use state::FetchState;
|
use state::FetchState;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -441,6 +441,16 @@ impl FetchState {
|
||||||
start.elapsed().as_millis()
|
start.elapsed().as_millis()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// N.b. signal to exit the upload-pack sequence
|
||||||
|
// We're finished fetching on this side, and all that's left
|
||||||
|
// is validation.
|
||||||
|
match handle.transport.done() {
|
||||||
|
Ok(()) => log::debug!(target: "fetch", "Sent done signal to remote {remote}"),
|
||||||
|
Err(err) => {
|
||||||
|
log::warn!(target: "fetch", "Attempted to send done to remote {remote}: {err}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Run validation of signed refs, pruning any offending
|
// Run validation of signed refs, pruning any offending
|
||||||
// remotes from the tips, thus not updating the production Git
|
// remotes from the tips, thus not updating the production Git
|
||||||
// repository.
|
// repository.
|
||||||
|
|
@ -543,9 +553,6 @@ impl FetchState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// N.b. signal to exit the upload-pack sequence
|
|
||||||
handle.transport.done()?;
|
|
||||||
|
|
||||||
log::debug!(
|
log::debug!(
|
||||||
target: "fetch",
|
target: "fetch",
|
||||||
"Validated {} remotes ({}ms)",
|
"Validated {} remotes ({}ms)",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue