Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/replication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,13 @@ async fn handle_audit_challenge_msg(
) -> Result<()> {
#[allow(clippy::cast_possible_truncation)]
let stored_chunks = storage.current_chunks().map_or(0, |c| c as usize);
info!(
"Audit challenge received: kind=responsible keys={} bootstrapping={} request_response={}",
challenge.keys.len(),
is_bootstrapping,
rr_message_id.is_some(),
);

let response = audit::handle_audit_challenge(
challenge,
storage,
Expand All @@ -1650,19 +1657,43 @@ async fn handle_audit_challenge_msg(
stored_chunks,
)
.await;
let response_kind = audit_response_kind(&response);

send_replication_response(
let sent = send_replication_response_checked(
source,
p2p_node,
request_id,
ReplicationMessageBody::AuditResponse(response),
rr_message_id,
)
.await;
if sent {
info!(
"Audit challenge reply sent: kind=responsible response={} keys={} request_response={}",
response_kind,
challenge.keys.len(),
rr_message_id.is_some(),
);
} else {
warn!(
"Audit challenge reply not sent: kind=responsible response={} keys={} request_response={}",
response_kind,
challenge.keys.len(),
rr_message_id.is_some(),
);
}

Ok(())
}

fn audit_response_kind(response: &protocol::AuditResponse) -> &'static str {
match response {
protocol::AuditResponse::Digests { .. } => "digests",
protocol::AuditResponse::Bootstrapping { .. } => "bootstrapping",
protocol::AuditResponse::Rejected { .. } => "rejected",
}
}

// ---------------------------------------------------------------------------
// Message sending helper
// ---------------------------------------------------------------------------
Expand Down
Loading