|
|
|
|
@ -1188,8 +1188,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
@@ -1188,8 +1188,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
|
|
|
|
let mut pdus = vec![]; |
|
|
|
|
for id in events { |
|
|
|
|
// a. Look at auth cache
|
|
|
|
|
let pdu = |
|
|
|
|
match auth_cache.get(id) { |
|
|
|
|
let pdu = match auth_cache.get(id) { |
|
|
|
|
Some(pdu) => { |
|
|
|
|
debug!("Found {} in cache", id); |
|
|
|
|
// We already have the auth chain for events in cache
|
|
|
|
|
@ -1226,7 +1225,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
@@ -1226,7 +1225,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
|
|
|
|
{ |
|
|
|
|
Ok(res) => { |
|
|
|
|
debug!("Got {} over federation: {:?}", id, res); |
|
|
|
|
let (event_id, value) = |
|
|
|
|
let (event_id, mut value) = |
|
|
|
|
crate::pdu::gen_event_id_canonical_json(&res.pdu)?; |
|
|
|
|
// This will also fetch the auth chain
|
|
|
|
|
match handle_incoming_pdu( |
|
|
|
|
@ -1240,11 +1239,17 @@ pub(crate) fn fetch_and_handle_events<'a>(
@@ -1240,11 +1239,17 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
|
|
|
|
) |
|
|
|
|
.await |
|
|
|
|
{ |
|
|
|
|
Ok(_) => Arc::new(serde_json::from_value( |
|
|
|
|
serde_json::to_value(value) |
|
|
|
|
.expect("canonicaljsonobject is valid value"), |
|
|
|
|
) |
|
|
|
|
.expect("This is possible because handle_incoming_pdu worked")), |
|
|
|
|
Ok(_) => { |
|
|
|
|
value.insert( |
|
|
|
|
"event_id".to_owned(), |
|
|
|
|
to_canonical_value(&event_id) |
|
|
|
|
.expect("EventId is a valid CanonicalJsonValue"), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
Arc::new(serde_json::from_value( |
|
|
|
|
serde_json::to_value(value).expect("canonicaljsonobject is valid value"), |
|
|
|
|
).expect("This is possible because handle_incoming_pdu worked")) |
|
|
|
|
} |
|
|
|
|
Err(e) => { |
|
|
|
|
warn!("Authentication of event {} failed: {:?}", id, e); |
|
|
|
|
continue; |
|
|
|
|
|