Browse Source

bump matrix-sdk

The new commit includes improvments for how the sdk handles http request
errors, and allows us to configure how often a request should be
retried.
merge-requests/1327/merge
Julian Sparber 5 years ago
parent
commit
c1b65dc69c
  1. 80
      Cargo.lock
  2. 2
      Cargo.toml
  3. 28
      src/session/mod.rs

80
Cargo.lock generated

@ -893,7 +893,7 @@ source = "git+https://github.com/gtk-rs/gtk-rs#6a7737fdb47afe38939ddb148e27c7f8f
dependencies = [
"anyhow",
"heck",
"proc-macro-crate",
"proc-macro-crate 0.1.5",
"proc-macro-error",
"proc-macro2",
"quote",
@ -1019,7 +1019,7 @@ dependencies = [
"anyhow",
"heck",
"itertools 0.9.0",
"proc-macro-crate",
"proc-macro-crate 0.1.5",
"proc-macro-error",
"proc-macro2",
"quote",
@ -1197,6 +1197,7 @@ checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
dependencies = [
"autocfg",
"hashbrown",
"serde",
]
[[package]]
@ -1369,7 +1370,7 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
name = "matrix-sdk"
version = "0.2.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=ef6e481860d9b6028efb51cfff2a6850b0ced502#ef6e481860d9b6028efb51cfff2a6850b0ced502"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=b5de20349945afcde13a78f023b906f421bb9764#b5de20349945afcde13a78f023b906f421bb9764"
dependencies = [
"backoff",
"dashmap",
@ -1392,7 +1393,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-base"
version = "0.2.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=ef6e481860d9b6028efb51cfff2a6850b0ced502#ef6e481860d9b6028efb51cfff2a6850b0ced502"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=b5de20349945afcde13a78f023b906f421bb9764#b5de20349945afcde13a78f023b906f421bb9764"
dependencies = [
"chacha20poly1305",
"dashmap",
@ -1415,7 +1416,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-common"
version = "0.2.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=ef6e481860d9b6028efb51cfff2a6850b0ced502#ef6e481860d9b6028efb51cfff2a6850b0ced502"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=b5de20349945afcde13a78f023b906f421bb9764#b5de20349945afcde13a78f023b906f421bb9764"
dependencies = [
"async-trait",
"futures",
@ -1431,7 +1432,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-crypto"
version = "0.2.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=ef6e481860d9b6028efb51cfff2a6850b0ced502#ef6e481860d9b6028efb51cfff2a6850b0ced502"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=b5de20349945afcde13a78f023b906f421bb9764#b5de20349945afcde13a78f023b906f421bb9764"
dependencies = [
"aes-ctr",
"aes-gcm",
@ -1900,6 +1901,16 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-crate"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92"
dependencies = [
"thiserror",
"toml",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
@ -2077,7 +2088,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.0.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"assign",
"js_int",
@ -2093,7 +2104,7 @@ dependencies = [
[[package]]
name = "ruma-api"
version = "0.17.0-alpha.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"http",
"percent-encoding",
@ -2108,9 +2119,9 @@ dependencies = [
[[package]]
name = "ruma-api-macros"
version = "0.17.0-alpha.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.0.0",
"proc-macro2",
"quote",
"syn",
@ -2119,7 +2130,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.10.0-alpha.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"assign",
"http",
@ -2137,21 +2148,24 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.3.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.3.1"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"indexmap",
"js_int",
"maplit",
"ruma-identifiers",
"ruma-serde",
"serde",
"serde_json",
"tracing",
"wildmatch",
]
[[package]]
name = "ruma-events"
version = "0.22.0-alpha.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"js_int",
"ruma-common",
@ -2165,9 +2179,9 @@ dependencies = [
[[package]]
name = "ruma-events-macros"
version = "0.22.0-alpha.2"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.0.0",
"proc-macro2",
"quote",
"syn",
@ -2176,7 +2190,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.1.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"js_int",
"ruma-api",
@ -2190,8 +2204,8 @@ dependencies = [
[[package]]
name = "ruma-identifiers"
version = "0.18.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.18.1"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"paste",
"ruma-identifiers-macros",
@ -2203,8 +2217,8 @@ dependencies = [
[[package]]
name = "ruma-identifiers-macros"
version = "0.18.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.18.1"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"proc-macro2",
"quote",
@ -2214,13 +2228,13 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.2.0"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.2.2"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
[[package]]
name = "ruma-serde"
version = "0.3.0"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.3.1"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"form_urlencoded",
"itoa",
@ -2232,10 +2246,10 @@ dependencies = [
[[package]]
name = "ruma-serde-macros"
version = "0.3.0"
source = "git+https://github.com/ruma/ruma?rev=92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd#92ee92ad7eb90b3c80abbd7eb116d886c79bf4fd"
version = "0.3.1"
source = "git+https://github.com/ruma/ruma?rev=2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25#2f1b9f097930bf7908ca539f2ab7bb0ccf5d8b25"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.0.0",
"proc-macro2",
"quote",
"syn",
@ -3089,6 +3103,12 @@ dependencies = [
"cc",
]
[[package]]
name = "wildmatch"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07ae7ce410f81ba679081aac1d4874f3b1c328535b630209aa5b4cdaaf895e20"
[[package]]
name = "winapi"
version = "0.3.9"
@ -3149,7 +3169,7 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc141cda72384bef359badf1808e391d3968f9299e8f3c3cbb78dafa1e0930"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",
@ -3194,7 +3214,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27d7c34325a35020b94343389cc9391e0f8ac245cca9155429c4022d93141241"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",

2
Cargo.toml

@ -27,5 +27,5 @@ git = "https://gitlab.gnome.org/bilelmoussaoui/libadwaita-rs.git"
[dependencies.matrix-sdk]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
rev = "ef6e481860d9b6028efb51cfff2a6850b0ced502"
rev = "b5de20349945afcde13a78f023b906f421bb9764"
features = ["unstable-synapse-quirks", "socks", "encryption", "sled_cryptostore", "sled_state_store"]

28
src/session/mod.rs

@ -20,7 +20,7 @@ use matrix_sdk::api::r0::{
filter::{FilterDefinition, RoomFilter},
session::login,
};
use matrix_sdk::{self, Client, ClientConfig, SyncSettings};
use matrix_sdk::{self, Client, ClientConfig, RequestConfig, SyncSettings};
use std::time::Duration;
mod imp {
@ -162,7 +162,7 @@ impl FrctlSession {
let sender = self.setup();
let config = ClientConfig::new().timeout(Duration::from_secs(15));
let config = ClientConfig::new().request_config(RequestConfig::new().retry_limit(2));
// Please note the homeserver needs to be a valid url or the client will panic!
let client = Client::new_with_config(homeserver.as_str(), config);
@ -192,27 +192,9 @@ impl FrctlSession {
success
}
CreationMethod::Password(username, password) => {
// FIXME: client won't return if the homeserver isn't any real domain, I think
// it has to do something with the dns lookup, therefore, we add a timeout of
// 15s for the login and return a mocked Error.
let response = tokio::time::timeout(
Duration::from_secs(15),
client.login(&username, &password, None, Some("Fractal Next")),
)
.await;
if let Err(_) = response {
send!(
sender,
Err(matrix_sdk::Error::Http(
matrix_sdk::HttpError::NotClientRequest
))
);
return;
}
let response = response.unwrap();
let response = client
.login(&username, &password, None, Some("Fractal Next"))
.await;
let success = response.is_ok();
send!(sender, response.map(|r| Some(r)));
success

Loading…
Cancel
Save