fetch: log handshake error
When performing a handshake, the error source is hidden in the error variant and never shown. To get insight as to what the error was, it is logged when it is encounterd. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
6efd0d97a5
commit
c02ff1e47e
|
|
@ -9,6 +9,7 @@ mod refs;
|
|||
mod stage;
|
||||
mod state;
|
||||
|
||||
use gix_protocol::handshake;
|
||||
pub use handle::Handle;
|
||||
pub use policy::{Allowed, BlockList, Scope};
|
||||
use radicle::storage::ReadRepository as _;
|
||||
|
|
@ -62,10 +63,7 @@ where
|
|||
if local == remote {
|
||||
return Err(Error::ReplicateSelf);
|
||||
}
|
||||
let handshake = handle
|
||||
.transport
|
||||
.handshake()
|
||||
.map_err(|err| Error::Handshake { err })?;
|
||||
let handshake = perform_handshake(handle)?;
|
||||
let state = FetchState::default();
|
||||
|
||||
// N.b. ensure that we ignore the local peer's key.
|
||||
|
|
@ -99,10 +97,7 @@ where
|
|||
if *handle.local() == remote {
|
||||
return Err(Error::ReplicateSelf);
|
||||
}
|
||||
let handshake = handle
|
||||
.transport
|
||||
.handshake()
|
||||
.map_err(|err| Error::Handshake { err })?;
|
||||
let handshake = perform_handshake(handle)?;
|
||||
let state = FetchState::default();
|
||||
let result = state
|
||||
.run(handle, &handshake, limit, remote, None)
|
||||
|
|
@ -116,3 +111,13 @@ where
|
|||
);
|
||||
result
|
||||
}
|
||||
|
||||
fn perform_handshake<S>(handle: &mut Handle<S>) -> Result<handshake::Outcome, Error>
|
||||
where
|
||||
S: transport::ConnectionStream,
|
||||
{
|
||||
handle.transport.handshake().map_err(|err| {
|
||||
log::warn!(target: "fetch", "Failed to perform handshake: {err}");
|
||||
Error::Handshake { err }
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue