mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-04 18:08:53 +01:00
Merge branch 'fix-fetch' into 'master'
fix: bug when fetching events over federation See merge request famedly/conduit!62
This commit is contained in:
commit
ad19264c38
2 changed files with 56 additions and 51 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Getting help
|
## Getting help
|
||||||
|
|
||||||
If you run into any problems while setting up Conduit, write an email to `support@conduit.rs`, ask us in `#conduit:matrix.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new).
|
If you run into any problems while setting up Conduit, write an email to `timo@koesters.xyz`, ask us in `#conduit:matrix.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new).
|
||||||
|
|
||||||
## Installing Conduit
|
## Installing Conduit
|
||||||
|
|
||||||
|
|
|
@ -1188,8 +1188,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
||||||
let mut pdus = vec![];
|
let mut pdus = vec![];
|
||||||
for id in events {
|
for id in events {
|
||||||
// a. Look at auth cache
|
// a. Look at auth cache
|
||||||
let pdu =
|
let pdu = match auth_cache.get(id) {
|
||||||
match auth_cache.get(id) {
|
|
||||||
Some(pdu) => {
|
Some(pdu) => {
|
||||||
debug!("Found {} in cache", id);
|
debug!("Found {} in cache", id);
|
||||||
// We already have the auth chain for events in cache
|
// We already have the auth chain for events in cache
|
||||||
|
@ -1226,7 +1225,7 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
||||||
{
|
{
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
debug!("Got {} over federation: {:?}", id, 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)?;
|
crate::pdu::gen_event_id_canonical_json(&res.pdu)?;
|
||||||
// This will also fetch the auth chain
|
// This will also fetch the auth chain
|
||||||
match handle_incoming_pdu(
|
match handle_incoming_pdu(
|
||||||
|
@ -1240,11 +1239,17 @@ pub(crate) fn fetch_and_handle_events<'a>(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(_) => Arc::new(serde_json::from_value(
|
Ok(_) => {
|
||||||
serde_json::to_value(value)
|
value.insert(
|
||||||
.expect("canonicaljsonobject is valid value"),
|
"event_id".to_owned(),
|
||||||
)
|
to_canonical_value(&event_id)
|
||||||
.expect("This is possible because handle_incoming_pdu worked")),
|
.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) => {
|
Err(e) => {
|
||||||
warn!("Authentication of event {} failed: {:?}", id, e);
|
warn!("Authentication of event {} failed: {:?}", id, e);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue