From 2770ce2cf61f71c835f5952558b7fe463d61217d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Wed, 1 Sep 2021 22:49:16 +0200 Subject: [PATCH] fix: avoid panic --- README.md | 8 +++----- src/ruma_wrapper.rs | 6 +++++- src/server_server.rs | 8 +------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 34344c9d..9d8de2b8 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,14 @@ HQ. #### What is the current status? -As of 2021-09-01 Conduit is Beta, meaning you can join and participate in most +As of 2021-09-01, Conduit is Beta, meaning you can join and participate in most Matrix rooms, but not all features are supported and you might run into bugs from time to time. There are still a few important features missing: -- Database stability (currently you might have to do manual upgrades or even wipe the db for new versions) -- Edge cases for end-to-end encryption over federation -- Typing and presence over federation -- Lots of testing +- E2EE verification over federation +- Outgoing read receipts, typing, presence over federation Check out the [Conduit 1.0 Release Milestone](https://gitlab.com/famedly/conduit/-/milestones/3). diff --git a/src/ruma_wrapper.rs b/src/ruma_wrapper.rs index 56811942..fa283790 100644 --- a/src/ruma_wrapper.rs +++ b/src/ruma_wrapper.rs @@ -66,7 +66,11 @@ where let limit = db.globals.max_request_size(); let mut handle = data.open(ByteUnit::Byte(limit.into())); let mut body = Vec::new(); - handle.read_to_end(&mut body).await.unwrap(); + if let Err(_) = handle.read_to_end(&mut body).await { + // Client disconnected + // Missing Token + return Failure((Status::new(582), ())); + } let mut json_body = serde_json::from_slice::(&body).ok(); diff --git a/src/server_server.rs b/src/server_server.rs index 122545a4..bac7203c 100644 --- a/src/server_server.rs +++ b/src/server_server.rs @@ -1439,13 +1439,7 @@ async fn upgrade_outlier_to_timeline_pdu( let fork_states = &fork_states .into_iter() - .map(|map| { - map.into_iter() - .map(|(k, id)| { - (k, (*id).clone()) - }) - .collect() - }) + .map(|map| map.into_iter().map(|(k, id)| (k, (*id).clone())).collect()) .collect::>(); state_at_incoming_event = match state_res::StateResolution::resolve(