Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb8c7542bd | ||
|
|
1601027605 | ||
|
|
afca61fe7c | ||
|
|
9bff276fa9 | ||
|
|
19b89ab91f | ||
|
|
0330d3e270 | ||
|
|
a1e8a99db5 | ||
|
|
33172a70e6 | ||
|
|
1b56a7bbfd | ||
|
|
d485eb5a24 | ||
|
|
41d07be97b | ||
|
|
bef4fe50ce | ||
|
|
9152b877a7 | ||
|
|
9f8c45c763 |
Generated
+147
-165
@@ -146,9 +146,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.2.1"
|
version = "1.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake2b_simd"
|
name = "blake2b_simd"
|
||||||
@@ -190,9 +190,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.0.1"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
|
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
@@ -295,12 +295,6 @@ version = "0.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "convert_case"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
version = "0.15.1"
|
version = "0.15.1"
|
||||||
@@ -330,9 +324,9 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
version = "0.1.5"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef"
|
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -372,9 +366,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-deque"
|
name = "crossbeam-deque"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
|
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"crossbeam-epoch",
|
"crossbeam-epoch",
|
||||||
@@ -435,9 +429,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "curve25519-dalek"
|
name = "curve25519-dalek"
|
||||||
version = "3.1.0"
|
version = "3.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "639891fde0dbea823fc3d798a0fdf9d2f9440a42d64a78ab3488b0ca025117b3"
|
checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"digest",
|
"digest",
|
||||||
@@ -464,26 +458,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "der"
|
name = "der"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49f215f706081a44cb702c71c39a52c05da637822e9c1645a50b7202689e982d"
|
checksum = "31e21d2d0f22cde6e88694108429775c0219760a07779bf96503b434a03d7412"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const-oid",
|
"const-oid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "derive_more"
|
|
||||||
version = "0.99.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df"
|
|
||||||
dependencies = [
|
|
||||||
"convert_case",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"rustc_version 0.3.3",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "devise"
|
name = "devise"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@@ -839,9 +820,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726"
|
checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -952,9 +933,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body"
|
name = "http-body"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9"
|
checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
@@ -963,9 +944,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.4.1"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68"
|
checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httpdate"
|
name = "httpdate"
|
||||||
@@ -984,9 +965,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "0.14.11"
|
version = "0.14.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11"
|
checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -1044,7 +1025,7 @@ dependencies = [
|
|||||||
"gif",
|
"gif",
|
||||||
"jpeg-decoder",
|
"jpeg-decoder",
|
||||||
"num-iter",
|
"num-iter",
|
||||||
"num-rational",
|
"num-rational 0.3.2",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"png",
|
"png",
|
||||||
]
|
]
|
||||||
@@ -1128,15 +1109,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.7"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
version = "0.1.22"
|
version = "0.1.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -1149,9 +1130,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.51"
|
version = "0.3.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
|
checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
@@ -1187,9 +1168,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.98"
|
version = "0.2.101"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
|
checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libsqlite3-sys"
|
name = "libsqlite3-sys"
|
||||||
@@ -1282,15 +1263,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matches"
|
name = "matches"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.4.0"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
@@ -1340,12 +1321,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "multer"
|
name = "multer"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fdd568fea4758b30d6423f013f7171e193c34aa97828d1bd9f924fb3af30a8c"
|
checksum = "408327e2999b839cd1af003fc01b2019a6c10a1361769542203f6fedc5179680"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"derive_more",
|
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
@@ -1368,6 +1348,20 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
|
||||||
|
dependencies = [
|
||||||
|
"num-bigint 0.4.0",
|
||||||
|
"num-complex",
|
||||||
|
"num-integer",
|
||||||
|
"num-iter",
|
||||||
|
"num-rational 0.4.0",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-bigint"
|
name = "num-bigint"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
@@ -1379,6 +1373,26 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-bigint"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-complex"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.44"
|
version = "0.1.44"
|
||||||
@@ -1411,6 +1425,18 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-rational"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-bigint 0.4.0",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
@@ -1598,15 +1624,6 @@ version = "2.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pest"
|
|
||||||
version = "2.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
|
|
||||||
dependencies = [
|
|
||||||
"ucd-trie",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
@@ -1826,9 +1843,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.9"
|
version = "0.2.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
|
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
@@ -2045,7 +2062,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2066,7 +2083,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-api"
|
name = "ruma-api"
|
||||||
version = "0.18.3"
|
version = "0.18.3"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
@@ -2082,7 +2099,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-api-macros"
|
name = "ruma-api-macros"
|
||||||
version = "0.18.3"
|
version = "0.18.3"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -2093,7 +2110,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -2107,7 +2124,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.12.2"
|
version = "0.12.2"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -2127,7 +2144,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2142,7 +2159,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.24.4"
|
version = "0.24.4"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indoc",
|
"indoc",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2158,7 +2175,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events-macros"
|
name = "ruma-events-macros"
|
||||||
version = "0.24.4"
|
version = "0.24.4"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -2169,7 +2186,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
@@ -2184,7 +2201,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers"
|
name = "ruma-identifiers"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"paste",
|
"paste",
|
||||||
"rand 0.8.4",
|
"rand 0.8.4",
|
||||||
@@ -2198,7 +2215,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-macros"
|
name = "ruma-identifiers-macros"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"ruma-identifiers-validation",
|
"ruma-identifiers-validation",
|
||||||
@@ -2208,7 +2225,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@@ -2216,7 +2233,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identity-service-api"
|
name = "ruma-identity-service-api"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
@@ -2229,7 +2246,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-api",
|
"ruma-api",
|
||||||
@@ -2244,7 +2261,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-serde"
|
name = "ruma-serde"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
@@ -2258,7 +2275,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-serde-macros"
|
name = "ruma-serde-macros"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -2269,7 +2286,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
@@ -2286,7 +2303,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/timokoesters/ruma?rev=2215049b60a1c3358f5a52215adf1e7bb88619a1#2215049b60a1c3358f5a52215adf1e7bb88619a1"
|
source = "git+https://github.com/DevinR528/ruma?rev=c7860fcb89dbde636e2c83d0636934fb9924f40c#c7860fcb89dbde636e2c83d0636934fb9924f40c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools 0.10.1",
|
"itertools 0.10.1",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2334,16 +2351,7 @@ version = "0.2.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver 0.9.0",
|
"semver",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
|
|
||||||
dependencies = [
|
|
||||||
"semver 0.11.0",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2417,22 +2425,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework"
|
name = "security-framework"
|
||||||
version = "2.3.1"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467"
|
checksum = "5b9bd29cdffb8875b04f71c51058f940cf4e390bbfd2ce669c4f22cd70b492a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
|
"num",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework-sys"
|
name = "security-framework-sys"
|
||||||
version = "2.3.0"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284"
|
checksum = "19133a286e494cc3311c165c4676ccb1fd47bed45b55f9d71fbd784ad4cea6f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -2444,16 +2453,7 @@ version = "0.9.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver-parser 0.7.0",
|
"semver-parser",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser 0.10.2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2462,29 +2462,20 @@ version = "0.7.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.10.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
|
||||||
dependencies = [
|
|
||||||
"pest",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.126"
|
version = "1.0.129"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.126"
|
version = "1.0.129"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2516,12 +2507,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.8.17"
|
version = "0.8.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
|
checksum = "ad104641f3c958dab30eb3010e834c2622d1f3f4c530fef1dee20ad9485f3c09"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dtoa",
|
"dtoa",
|
||||||
"linked-hash-map",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
"yaml-rust",
|
"yaml-rust",
|
||||||
]
|
]
|
||||||
@@ -2534,9 +2525,9 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.9.5"
|
version = "0.9.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12"
|
checksum = "9204c41a1597a8c5af23c82d1c921cb01ec0a4c59e07a9c7306062829a3903f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
@@ -2547,9 +2538,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.1"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3"
|
checksum = "740223c51853f3145fe7c90360d2d4232f2b62e3449489c207eccde818979982"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
@@ -2576,15 +2567,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b"
|
checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"num-bigint",
|
"num-bigint 0.2.6",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
|
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sled"
|
name = "sled"
|
||||||
@@ -2685,7 +2676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
|
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"discard",
|
"discard",
|
||||||
"rustc_version 0.2.3",
|
"rustc_version",
|
||||||
"stdweb-derive",
|
"stdweb-derive",
|
||||||
"stdweb-internal-macros",
|
"stdweb-internal-macros",
|
||||||
"stdweb-internal-runtime",
|
"stdweb-internal-runtime",
|
||||||
@@ -2735,9 +2726,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.74"
|
version = "1.0.75"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c"
|
checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2904,9 +2895,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.9.0"
|
version = "1.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c"
|
checksum = "92036be488bb6594459f2e03b60e42df6f937fe6ca5c5ffdcb539c6b84dc40f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -3020,9 +3011,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.18"
|
version = "0.1.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052"
|
checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
@@ -3074,9 +3065,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-subscriber"
|
name = "tracing-subscriber"
|
||||||
version = "0.2.19"
|
version = "0.2.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ab69019741fca4d98be3c62d2b75254528b5432233fd8a4d2739fec20278de48"
|
checksum = "b9cbe87a2fa7e35900ce5de20220a582a9483a7063811defce79d7cbd59d4cfe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -3170,12 +3161,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ucd-trie"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uncased"
|
name = "uncased"
|
||||||
version = "0.9.6"
|
version = "0.9.6"
|
||||||
@@ -3194,12 +3179,9 @@ checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "unicode-bidi"
|
||||||
version = "0.3.5"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
|
checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085"
|
||||||
dependencies = [
|
|
||||||
"matches",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-normalization"
|
name = "unicode-normalization"
|
||||||
@@ -3282,9 +3264,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.74"
|
version = "0.2.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -3294,9 +3276,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.74"
|
version = "0.2.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -3309,9 +3291,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.4.24"
|
version = "0.4.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1"
|
checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -3321,9 +3303,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.74"
|
version = "0.2.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -3331,9 +3313,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.74"
|
version = "0.2.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -3344,15 +3326,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.74"
|
version = "0.2.76"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.51"
|
version = "0.3.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582"
|
checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|||||||
+2
-1
@@ -18,8 +18,9 @@ edition = "2018"
|
|||||||
rocket = { version = "0.5.0-rc.1", features = ["tls"] } # Used to handle requests
|
rocket = { version = "0.5.0-rc.1", features = ["tls"] } # Used to handle requests
|
||||||
|
|
||||||
# Used for matrix spec type definitions and helpers
|
# Used for matrix spec type definitions and helpers
|
||||||
|
#ruma = { version = "0.4.0", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
#ruma = { git = "https://github.com/ruma/ruma", rev = "f5ab038e22421ed338396ece977b6b2844772ced", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
#ruma = { git = "https://github.com/ruma/ruma", rev = "f5ab038e22421ed338396ece977b6b2844772ced", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
ruma = { git = "https://github.com/timokoesters/ruma", rev = "2215049b60a1c3358f5a52215adf1e7bb88619a1", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
ruma = { git = "https://github.com/DevinR528/ruma", rev = "c7860fcb89dbde636e2c83d0636934fb9924f40c", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
#ruma = { path = "../ruma/crates/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
#ruma = { path = "../ruma/crates/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
|
|
||||||
# Used for long polling and federation sender, should be the same as rocket::tokio
|
# Used for long polling and federation sender, should be the same as rocket::tokio
|
||||||
|
|||||||
@@ -46,7 +46,11 @@ where
|
|||||||
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
|
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
|
||||||
|
|
||||||
let url = reqwest_request.url().clone();
|
let url = reqwest_request.url().clone();
|
||||||
let mut response = globals.reqwest_client().execute(reqwest_request).await?;
|
let mut response = globals
|
||||||
|
.reqwest_client()?
|
||||||
|
.build()?
|
||||||
|
.execute(reqwest_request)
|
||||||
|
.await?;
|
||||||
|
|
||||||
// reqwest::Response -> http::Response conversion
|
// reqwest::Response -> http::Response conversion
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
|
|||||||
+37
-23
@@ -1,5 +1,6 @@
|
|||||||
use super::SESSION_ID_LENGTH;
|
use super::SESSION_ID_LENGTH;
|
||||||
use crate::{database::DatabaseGuard, utils, ConduitResult, Database, Error, Result, Ruma};
|
use crate::{database::DatabaseGuard, utils, ConduitResult, Database, Error, Result, Ruma};
|
||||||
|
use rocket::futures::{prelude::*, stream::FuturesUnordered};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
client::{
|
client::{
|
||||||
@@ -18,7 +19,7 @@ use ruma::{
|
|||||||
DeviceId, DeviceKeyAlgorithm, UserId,
|
DeviceId, DeviceKeyAlgorithm, UserId,
|
||||||
};
|
};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::collections::{BTreeMap, HashSet};
|
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
|
|
||||||
#[cfg(feature = "conduit_bin")]
|
#[cfg(feature = "conduit_bin")]
|
||||||
use rocket::{get, post};
|
use rocket::{get, post};
|
||||||
@@ -112,7 +113,7 @@ pub async fn claim_keys_route(
|
|||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "conduit_bin",
|
feature = "conduit_bin",
|
||||||
post("/_matrix/client/unstable/keys/device_signing/upload", data = "<body>")
|
post("/_matrix/client/r0/keys/device_signing/upload", data = "<body>")
|
||||||
)]
|
)]
|
||||||
#[tracing::instrument(skip(db, body))]
|
#[tracing::instrument(skip(db, body))]
|
||||||
pub async fn upload_signing_keys_route(
|
pub async fn upload_signing_keys_route(
|
||||||
@@ -173,7 +174,7 @@ pub async fn upload_signing_keys_route(
|
|||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "conduit_bin",
|
feature = "conduit_bin",
|
||||||
post("/_matrix/client/unstable/keys/signatures/upload", data = "<body>")
|
post("/_matrix/client/r0/keys/signatures/upload", data = "<body>")
|
||||||
)]
|
)]
|
||||||
#[tracing::instrument(skip(db, body))]
|
#[tracing::instrument(skip(db, body))]
|
||||||
pub async fn upload_signatures_route(
|
pub async fn upload_signatures_route(
|
||||||
@@ -294,7 +295,7 @@ pub async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||||||
let mut user_signing_keys = BTreeMap::new();
|
let mut user_signing_keys = BTreeMap::new();
|
||||||
let mut device_keys = BTreeMap::new();
|
let mut device_keys = BTreeMap::new();
|
||||||
|
|
||||||
let mut get_over_federation = BTreeMap::new();
|
let mut get_over_federation = HashMap::new();
|
||||||
|
|
||||||
for (user_id, device_ids) in device_keys_input {
|
for (user_id, device_ids) in device_keys_input {
|
||||||
if user_id.server_name() != db.globals.server_name() {
|
if user_id.server_name() != db.globals.server_name() {
|
||||||
@@ -364,22 +365,30 @@ pub async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||||||
|
|
||||||
let mut failures = BTreeMap::new();
|
let mut failures = BTreeMap::new();
|
||||||
|
|
||||||
for (server, vec) in get_over_federation {
|
let mut futures = get_over_federation
|
||||||
let mut device_keys_input_fed = BTreeMap::new();
|
.into_iter()
|
||||||
for (user_id, keys) in vec {
|
.map(|(server, vec)| async move {
|
||||||
device_keys_input_fed.insert(user_id.clone(), keys.clone());
|
let mut device_keys_input_fed = BTreeMap::new();
|
||||||
}
|
for (user_id, keys) in vec {
|
||||||
match db
|
device_keys_input_fed.insert(user_id.clone(), keys.clone());
|
||||||
.sending
|
}
|
||||||
.send_federation_request(
|
(
|
||||||
&db.globals,
|
|
||||||
server,
|
server,
|
||||||
federation::keys::get_keys::v1::Request {
|
db.sending
|
||||||
device_keys: device_keys_input_fed,
|
.send_federation_request(
|
||||||
},
|
&db.globals,
|
||||||
|
server,
|
||||||
|
federation::keys::get_keys::v1::Request {
|
||||||
|
device_keys: device_keys_input_fed,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await,
|
||||||
)
|
)
|
||||||
.await
|
})
|
||||||
{
|
.collect::<FuturesUnordered<_>>();
|
||||||
|
|
||||||
|
while let Some((server, response)) = futures.next().await {
|
||||||
|
match response {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
master_keys.extend(response.master_keys);
|
master_keys.extend(response.master_keys);
|
||||||
self_signing_keys.extend(response.self_signing_keys);
|
self_signing_keys.extend(response.self_signing_keys);
|
||||||
@@ -430,13 +439,15 @@ pub async fn claim_keys_helper(
|
|||||||
one_time_keys.insert(user_id.clone(), container);
|
one_time_keys.insert(user_id.clone(), container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut failures = BTreeMap::new();
|
||||||
|
|
||||||
for (server, vec) in get_over_federation {
|
for (server, vec) in get_over_federation {
|
||||||
let mut one_time_keys_input_fed = BTreeMap::new();
|
let mut one_time_keys_input_fed = BTreeMap::new();
|
||||||
for (user_id, keys) in vec {
|
for (user_id, keys) in vec {
|
||||||
one_time_keys_input_fed.insert(user_id.clone(), keys.clone());
|
one_time_keys_input_fed.insert(user_id.clone(), keys.clone());
|
||||||
}
|
}
|
||||||
// Ignore failures
|
// Ignore failures
|
||||||
let keys = db
|
if let Ok(keys) = db
|
||||||
.sending
|
.sending
|
||||||
.send_federation_request(
|
.send_federation_request(
|
||||||
&db.globals,
|
&db.globals,
|
||||||
@@ -445,13 +456,16 @@ pub async fn claim_keys_helper(
|
|||||||
one_time_keys: one_time_keys_input_fed,
|
one_time_keys: one_time_keys_input_fed,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await
|
||||||
|
{
|
||||||
one_time_keys.extend(keys.one_time_keys);
|
one_time_keys.extend(keys.one_time_keys);
|
||||||
|
} else {
|
||||||
|
failures.insert(server.to_string(), json!({}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(claim_keys::Response {
|
Ok(claim_keys::Response {
|
||||||
failures: BTreeMap::new(),
|
failures,
|
||||||
one_time_keys,
|
one_time_keys,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-81
@@ -12,7 +12,7 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use tokio::sync::watch::Sender;
|
use tokio::sync::watch::Sender;
|
||||||
use tracing::{error, warn};
|
use tracing::error;
|
||||||
|
|
||||||
#[cfg(feature = "conduit_bin")]
|
#[cfg(feature = "conduit_bin")]
|
||||||
use rocket::{get, tokio};
|
use rocket::{get, tokio};
|
||||||
@@ -246,36 +246,18 @@ async fn sync_helper(
|
|||||||
.current_shortstatehash(&room_id)?
|
.current_shortstatehash(&room_id)?
|
||||||
.expect("All rooms have state");
|
.expect("All rooms have state");
|
||||||
|
|
||||||
let first_pdu_before_since = db
|
|
||||||
.rooms
|
|
||||||
.pdus_until(&sender_user, &room_id, since)?
|
|
||||||
.next()
|
|
||||||
.transpose()?;
|
|
||||||
|
|
||||||
let pdus_after_since = db
|
let pdus_after_since = db
|
||||||
.rooms
|
.rooms
|
||||||
.pdus_after(&sender_user, &room_id, since)?
|
.pdus_after(&sender_user, &room_id, since)?
|
||||||
.next()
|
.next()
|
||||||
.is_some();
|
.is_some();
|
||||||
|
|
||||||
let since_shortstatehash = first_pdu_before_since
|
let since_shortstatehash = db.rooms.get_token_shortstatehash(&room_id, since)?;
|
||||||
.as_ref()
|
|
||||||
.map(|pdu| {
|
|
||||||
db.rooms
|
|
||||||
.pdu_shortstatehash(&pdu.1.event_id)
|
|
||||||
.transpose()
|
|
||||||
.ok_or_else(|| {
|
|
||||||
warn!("PDU without state: {}", pdu.1.event_id);
|
|
||||||
Error::bad_database("Found PDU without state")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.transpose()?
|
|
||||||
.transpose()?;
|
|
||||||
|
|
||||||
// Calculates joined_member_count, invited_member_count and heroes
|
// Calculates joined_member_count, invited_member_count and heroes
|
||||||
let calculate_counts = || {
|
let calculate_counts = || {
|
||||||
let joined_member_count = db.rooms.room_members(&room_id).count();
|
let joined_member_count = db.rooms.room_joined_count(&room_id)?.unwrap_or(0);
|
||||||
let invited_member_count = db.rooms.room_members_invited(&room_id).count();
|
let invited_member_count = db.rooms.room_invited_count(&room_id)?.unwrap_or(0);
|
||||||
|
|
||||||
// Recalculate heroes (first 5 members)
|
// Recalculate heroes (first 5 members)
|
||||||
let mut heroes = Vec::new();
|
let mut heroes = Vec::new();
|
||||||
@@ -359,7 +341,7 @@ async fn sync_helper(
|
|||||||
true,
|
true,
|
||||||
state_events,
|
state_events,
|
||||||
)
|
)
|
||||||
} else if !pdus_after_since || since_shortstatehash == Some(current_shortstatehash) {
|
} else if !pdus_after_since && since_shortstatehash == Some(current_shortstatehash) {
|
||||||
// No state changes
|
// No state changes
|
||||||
(Vec::new(), None, None, false, Vec::new())
|
(Vec::new(), None, None, false, Vec::new())
|
||||||
} else {
|
} else {
|
||||||
@@ -400,11 +382,6 @@ async fn sync_helper(
|
|||||||
current_state_ids
|
current_state_ids
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(key, id)| since_state_ids.get(key) != Some(id))
|
.filter(|(key, id)| since_state_ids.get(key) != Some(id))
|
||||||
.filter(|(_, id)| {
|
|
||||||
!timeline_pdus
|
|
||||||
.iter()
|
|
||||||
.any(|(_, timeline_pdu)| timeline_pdu.event_id == **id)
|
|
||||||
})
|
|
||||||
.map(|(_, id)| db.rooms.get_pdu(id))
|
.map(|(_, id)| db.rooms.get_pdu(id))
|
||||||
.filter_map(|r| r.ok().flatten())
|
.filter_map(|r| r.ok().flatten())
|
||||||
.collect()
|
.collect()
|
||||||
@@ -430,64 +407,40 @@ async fn sync_helper(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if encrypted_room {
|
if encrypted_room {
|
||||||
for (user_id, current_member) in db
|
for state_event in &state_events {
|
||||||
.rooms
|
if state_event.kind != EventType::RoomMember {
|
||||||
.room_members(&room_id)
|
continue;
|
||||||
.filter_map(|r| r.ok())
|
}
|
||||||
.filter_map(|user_id| {
|
|
||||||
db.rooms
|
|
||||||
.state_get(
|
|
||||||
current_shortstatehash,
|
|
||||||
&EventType::RoomMember,
|
|
||||||
user_id.as_str(),
|
|
||||||
)
|
|
||||||
.ok()
|
|
||||||
.flatten()
|
|
||||||
.map(|current_member| (user_id, current_member))
|
|
||||||
})
|
|
||||||
{
|
|
||||||
let current_membership = serde_json::from_value::<
|
|
||||||
Raw<ruma::events::room::member::MemberEventContent>,
|
|
||||||
>(current_member.content.clone())
|
|
||||||
.expect("Raw::from_value always works")
|
|
||||||
.deserialize()
|
|
||||||
.map_err(|_| Error::bad_database("Invalid PDU in database."))?
|
|
||||||
.membership;
|
|
||||||
|
|
||||||
let since_membership = db
|
if let Some(state_key) = &state_event.state_key {
|
||||||
.rooms
|
let user_id = UserId::try_from(state_key.clone())
|
||||||
.state_get(
|
.map_err(|_| Error::bad_database("Invalid UserId in member PDU."))?;
|
||||||
since_shortstatehash,
|
|
||||||
&EventType::RoomMember,
|
|
||||||
user_id.as_str(),
|
|
||||||
)?
|
|
||||||
.and_then(|since_member| {
|
|
||||||
serde_json::from_value::<
|
|
||||||
Raw<ruma::events::room::member::MemberEventContent>,
|
|
||||||
>(since_member.content.clone())
|
|
||||||
.expect("Raw::from_value always works")
|
|
||||||
.deserialize()
|
|
||||||
.map_err(|_| Error::bad_database("Invalid PDU in database."))
|
|
||||||
.ok()
|
|
||||||
})
|
|
||||||
.map_or(MembershipState::Leave, |member| member.membership);
|
|
||||||
|
|
||||||
let user_id = UserId::try_from(user_id.clone())
|
if user_id == sender_user {
|
||||||
.map_err(|_| Error::bad_database("Invalid UserId in member PDU."))?;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
match (since_membership, current_membership) {
|
let new_membership = serde_json::from_value::<
|
||||||
(MembershipState::Leave, MembershipState::Join) => {
|
Raw<ruma::events::room::member::MemberEventContent>,
|
||||||
// A new user joined an encrypted room
|
>(state_event.content.clone())
|
||||||
if !share_encrypted_room(&db, &sender_user, &user_id, &room_id)? {
|
.expect("Raw::from_value always works")
|
||||||
device_list_updates.insert(user_id);
|
.deserialize()
|
||||||
|
.map_err(|_| Error::bad_database("Invalid PDU in database."))?
|
||||||
|
.membership;
|
||||||
|
|
||||||
|
match new_membership {
|
||||||
|
MembershipState::Join => {
|
||||||
|
// A new user joined an encrypted room
|
||||||
|
if !share_encrypted_room(&db, &sender_user, &user_id, &room_id)? {
|
||||||
|
device_list_updates.insert(user_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
MembershipState::Leave => {
|
||||||
|
// Write down users that have left encrypted rooms we are in
|
||||||
|
left_encrypted_users.insert(user_id);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
// TODO: Remove, this should never happen here, right?
|
|
||||||
(MembershipState::Join, MembershipState::Leave) => {
|
|
||||||
// Write down users that have left encrypted rooms we are in
|
|
||||||
left_encrypted_users.insert(user_id);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -585,6 +538,10 @@ async fn sync_helper(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save the state after this sync so we can send the correct state diff next sync
|
||||||
|
db.rooms
|
||||||
|
.associate_token_shortstatehash(&room_id, next_batch, current_shortstatehash)?;
|
||||||
|
|
||||||
let joined_room = sync_events::JoinedRoom {
|
let joined_room = sync_events::JoinedRoom {
|
||||||
account_data: sync_events::RoomAccountData {
|
account_data: sync_events::RoomAccountData {
|
||||||
events: db
|
events: db
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ pub async fn send_event_to_device_route(
|
|||||||
},
|
},
|
||||||
))
|
))
|
||||||
.expect("DirectToDevice EDU can be serialized"),
|
.expect("DirectToDevice EDU can be serialized"),
|
||||||
|
db.globals.next_count()?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+15
-2
@@ -252,6 +252,7 @@ impl Database {
|
|||||||
userroomid_joined: builder.open_tree("userroomid_joined")?,
|
userroomid_joined: builder.open_tree("userroomid_joined")?,
|
||||||
roomuserid_joined: builder.open_tree("roomuserid_joined")?,
|
roomuserid_joined: builder.open_tree("roomuserid_joined")?,
|
||||||
roomid_joinedcount: builder.open_tree("roomid_joinedcount")?,
|
roomid_joinedcount: builder.open_tree("roomid_joinedcount")?,
|
||||||
|
roomid_invitedcount: builder.open_tree("roomid_invitedcount")?,
|
||||||
roomuseroncejoinedids: builder.open_tree("roomuseroncejoinedids")?,
|
roomuseroncejoinedids: builder.open_tree("roomuseroncejoinedids")?,
|
||||||
userroomid_invitestate: builder.open_tree("userroomid_invitestate")?,
|
userroomid_invitestate: builder.open_tree("userroomid_invitestate")?,
|
||||||
roomuserid_invitecount: builder.open_tree("roomuserid_invitecount")?,
|
roomuserid_invitecount: builder.open_tree("roomuserid_invitecount")?,
|
||||||
@@ -264,6 +265,8 @@ impl Database {
|
|||||||
statekey_shortstatekey: builder.open_tree("statekey_shortstatekey")?,
|
statekey_shortstatekey: builder.open_tree("statekey_shortstatekey")?,
|
||||||
shortstatekey_statekey: builder.open_tree("shortstatekey_statekey")?,
|
shortstatekey_statekey: builder.open_tree("shortstatekey_statekey")?,
|
||||||
|
|
||||||
|
shorteventid_authchain: builder.open_tree("shorteventid_authchain")?,
|
||||||
|
|
||||||
roomid_shortroomid: builder.open_tree("roomid_shortroomid")?,
|
roomid_shortroomid: builder.open_tree("roomid_shortroomid")?,
|
||||||
|
|
||||||
shortstatehash_statediff: builder.open_tree("shortstatehash_statediff")?,
|
shortstatehash_statediff: builder.open_tree("shortstatehash_statediff")?,
|
||||||
@@ -271,17 +274,21 @@ impl Database {
|
|||||||
shorteventid_eventid: builder.open_tree("shorteventid_eventid")?,
|
shorteventid_eventid: builder.open_tree("shorteventid_eventid")?,
|
||||||
shorteventid_shortstatehash: builder.open_tree("shorteventid_shortstatehash")?,
|
shorteventid_shortstatehash: builder.open_tree("shorteventid_shortstatehash")?,
|
||||||
roomid_shortstatehash: builder.open_tree("roomid_shortstatehash")?,
|
roomid_shortstatehash: builder.open_tree("roomid_shortstatehash")?,
|
||||||
|
roomsynctoken_shortstatehash: builder.open_tree("roomsynctoken_shortstatehash")?,
|
||||||
statehash_shortstatehash: builder.open_tree("statehash_shortstatehash")?,
|
statehash_shortstatehash: builder.open_tree("statehash_shortstatehash")?,
|
||||||
|
|
||||||
eventid_outlierpdu: builder.open_tree("eventid_outlierpdu")?,
|
eventid_outlierpdu: builder.open_tree("eventid_outlierpdu")?,
|
||||||
|
softfailedeventids: builder.open_tree("softfailedeventids")?,
|
||||||
|
|
||||||
referencedevents: builder.open_tree("referencedevents")?,
|
referencedevents: builder.open_tree("referencedevents")?,
|
||||||
pdu_cache: Mutex::new(LruCache::new(100_000)),
|
pdu_cache: Mutex::new(LruCache::new(100_000)),
|
||||||
auth_chain_cache: Mutex::new(LruCache::new(100_000)),
|
auth_chain_cache: Mutex::new(LruCache::new(1_000_000)),
|
||||||
shorteventid_cache: Mutex::new(LruCache::new(1_000_000)),
|
shorteventid_cache: Mutex::new(LruCache::new(1_000_000)),
|
||||||
eventidshort_cache: Mutex::new(LruCache::new(1_000_000)),
|
eventidshort_cache: Mutex::new(LruCache::new(1_000_000)),
|
||||||
shortstatekey_cache: Mutex::new(LruCache::new(1_000_000)),
|
shortstatekey_cache: Mutex::new(LruCache::new(1_000_000)),
|
||||||
statekeyshort_cache: Mutex::new(LruCache::new(1_000_000)),
|
statekeyshort_cache: Mutex::new(LruCache::new(1_000_000)),
|
||||||
stateinfo_cache: Mutex::new(LruCache::new(1000)),
|
stateinfo_cache: Mutex::new(LruCache::new(1000)),
|
||||||
|
our_real_users_cache: RwLock::new(HashMap::new()),
|
||||||
},
|
},
|
||||||
account_data: account_data::AccountData {
|
account_data: account_data::AccountData {
|
||||||
roomuserdataid_accountdata: builder.open_tree("roomuserdataid_accountdata")?,
|
roomuserdataid_accountdata: builder.open_tree("roomuserdataid_accountdata")?,
|
||||||
@@ -439,7 +446,7 @@ impl Database {
|
|||||||
let room_id =
|
let room_id =
|
||||||
RoomId::try_from(utils::string_from_bytes(&roomid).unwrap()).unwrap();
|
RoomId::try_from(utils::string_from_bytes(&roomid).unwrap()).unwrap();
|
||||||
|
|
||||||
db.rooms.update_joined_count(&room_id)?;
|
db.rooms.update_joined_count(&room_id, &db)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
db.globals.bump_database_version(6)?;
|
db.globals.bump_database_version(6)?;
|
||||||
@@ -709,6 +716,12 @@ impl Database {
|
|||||||
.insert(&shortstatekey, &statekey)?;
|
.insert(&shortstatekey, &statekey)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force E2EE device list updates so we can send them over federation
|
||||||
|
for user_id in db.users.iter().filter_map(|r| r.ok()) {
|
||||||
|
db.users
|
||||||
|
.mark_device_key_update(&user_id, &db.rooms, &db.globals)?;
|
||||||
|
}
|
||||||
|
|
||||||
db.globals.bump_database_version(10)?;
|
db.globals.bump_database_version(10)?;
|
||||||
|
|
||||||
println!("Migration: 9 -> 10 finished");
|
println!("Migration: 9 -> 10 finished");
|
||||||
|
|||||||
@@ -93,9 +93,8 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn flush_wal(self: &Arc<Self>) -> Result<()> {
|
pub fn flush_wal(self: &Arc<Self>) -> Result<()> {
|
||||||
// We use autocheckpoints
|
self.write_lock()
|
||||||
//self.write_lock()
|
.pragma_update(Some(Main), "wal_checkpoint", &"TRUNCATE")?;
|
||||||
//.pragma_update(Some(Main), "wal_checkpoint", &"TRUNCATE")?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-61
@@ -1,4 +1,4 @@
|
|||||||
use crate::{database::Config, utils, ConduitResult, Error, Result};
|
use crate::{database::Config, server_server::FedDest, utils, ConduitResult, Error, Result};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
client::r0::sync::sync_events,
|
client::r0::sync::sync_events,
|
||||||
@@ -6,25 +6,25 @@ use ruma::{
|
|||||||
},
|
},
|
||||||
DeviceId, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId, UserId,
|
DeviceId, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId, UserId,
|
||||||
};
|
};
|
||||||
use rustls::{ServerCertVerifier, WebPKIVerifier};
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, HashMap},
|
collections::{BTreeMap, HashMap},
|
||||||
fs,
|
fs,
|
||||||
future::Future,
|
future::Future,
|
||||||
|
net::IpAddr,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{Arc, Mutex, RwLock},
|
sync::{Arc, Mutex, RwLock},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
use tokio::sync::{broadcast, watch::Receiver, Mutex as TokioMutex, Semaphore};
|
use tokio::sync::{broadcast, watch::Receiver, Mutex as TokioMutex, Semaphore};
|
||||||
use tracing::{error, info};
|
use tracing::error;
|
||||||
use trust_dns_resolver::TokioAsyncResolver;
|
use trust_dns_resolver::TokioAsyncResolver;
|
||||||
|
|
||||||
use super::abstraction::Tree;
|
use super::abstraction::Tree;
|
||||||
|
|
||||||
pub const COUNTER: &[u8] = b"c";
|
pub const COUNTER: &[u8] = b"c";
|
||||||
|
|
||||||
type WellKnownMap = HashMap<Box<ServerName>, (String, String)>;
|
type WellKnownMap = HashMap<Box<ServerName>, (FedDest, String)>;
|
||||||
type TlsNameMap = HashMap<String, webpki::DNSName>;
|
type TlsNameMap = HashMap<String, (Vec<IpAddr>, u16)>;
|
||||||
type RateLimitState = (Instant, u32); // Time if last failed try, number of failed tries
|
type RateLimitState = (Instant, u32); // Time if last failed try, number of failed tries
|
||||||
type SyncHandle = (
|
type SyncHandle = (
|
||||||
Option<String>, // since
|
Option<String>, // since
|
||||||
@@ -37,7 +37,6 @@ pub struct Globals {
|
|||||||
pub(super) globals: Arc<dyn Tree>,
|
pub(super) globals: Arc<dyn Tree>,
|
||||||
config: Config,
|
config: Config,
|
||||||
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
||||||
reqwest_client: reqwest::Client,
|
|
||||||
dns_resolver: TokioAsyncResolver,
|
dns_resolver: TokioAsyncResolver,
|
||||||
jwt_decoding_key: Option<jsonwebtoken::DecodingKey<'static>>,
|
jwt_decoding_key: Option<jsonwebtoken::DecodingKey<'static>>,
|
||||||
pub(super) server_signingkeys: Arc<dyn Tree>,
|
pub(super) server_signingkeys: Arc<dyn Tree>,
|
||||||
@@ -51,40 +50,6 @@ pub struct Globals {
|
|||||||
pub rotate: RotationHandler,
|
pub rotate: RotationHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MatrixServerVerifier {
|
|
||||||
inner: WebPKIVerifier,
|
|
||||||
tls_name_override: Arc<RwLock<TlsNameMap>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ServerCertVerifier for MatrixServerVerifier {
|
|
||||||
#[tracing::instrument(skip(self, roots, presented_certs, dns_name, ocsp_response))]
|
|
||||||
fn verify_server_cert(
|
|
||||||
&self,
|
|
||||||
roots: &rustls::RootCertStore,
|
|
||||||
presented_certs: &[rustls::Certificate],
|
|
||||||
dns_name: webpki::DNSNameRef<'_>,
|
|
||||||
ocsp_response: &[u8],
|
|
||||||
) -> std::result::Result<rustls::ServerCertVerified, rustls::TLSError> {
|
|
||||||
if let Some(override_name) = self.tls_name_override.read().unwrap().get(dns_name.into()) {
|
|
||||||
let result = self.inner.verify_server_cert(
|
|
||||||
roots,
|
|
||||||
presented_certs,
|
|
||||||
override_name.as_ref(),
|
|
||||||
ocsp_response,
|
|
||||||
);
|
|
||||||
if result.is_ok() {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
info!(
|
|
||||||
"Server {:?} is non-compliant, retrying TLS verification with original name",
|
|
||||||
dns_name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
self.inner
|
|
||||||
.verify_server_cert(roots, presented_certs, dns_name, ocsp_response)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Handles "rotation" of long-polling requests. "Rotation" in this context is similar to "rotation" of log files and the like.
|
/// Handles "rotation" of long-polling requests. "Rotation" in this context is similar to "rotation" of log files and the like.
|
||||||
///
|
///
|
||||||
/// This is utilized to have sync workers return early and release read locks on the database.
|
/// This is utilized to have sync workers return early and release read locks on the database.
|
||||||
@@ -162,24 +127,6 @@ impl Globals {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let tls_name_override = Arc::new(RwLock::new(TlsNameMap::new()));
|
let tls_name_override = Arc::new(RwLock::new(TlsNameMap::new()));
|
||||||
let verifier = Arc::new(MatrixServerVerifier {
|
|
||||||
inner: WebPKIVerifier::new(),
|
|
||||||
tls_name_override: tls_name_override.clone(),
|
|
||||||
});
|
|
||||||
let mut tlsconfig = rustls::ClientConfig::new();
|
|
||||||
tlsconfig.dangerous().set_certificate_verifier(verifier);
|
|
||||||
tlsconfig.root_store =
|
|
||||||
rustls_native_certs::load_native_certs().expect("Error loading system certificates");
|
|
||||||
|
|
||||||
let mut reqwest_client_builder = reqwest::Client::builder()
|
|
||||||
.connect_timeout(Duration::from_secs(30))
|
|
||||||
.timeout(Duration::from_secs(60 * 3))
|
|
||||||
.pool_max_idle_per_host(1)
|
|
||||||
.use_preconfigured_tls(tlsconfig);
|
|
||||||
if let Some(proxy) = config.proxy.to_proxy()? {
|
|
||||||
reqwest_client_builder = reqwest_client_builder.proxy(proxy);
|
|
||||||
}
|
|
||||||
let reqwest_client = reqwest_client_builder.build().unwrap();
|
|
||||||
|
|
||||||
let jwt_decoding_key = config
|
let jwt_decoding_key = config
|
||||||
.jwt_secret
|
.jwt_secret
|
||||||
@@ -190,7 +137,6 @@ impl Globals {
|
|||||||
globals,
|
globals,
|
||||||
config,
|
config,
|
||||||
keypair: Arc::new(keypair),
|
keypair: Arc::new(keypair),
|
||||||
reqwest_client,
|
|
||||||
dns_resolver: TokioAsyncResolver::tokio_from_system_conf().map_err(|_| {
|
dns_resolver: TokioAsyncResolver::tokio_from_system_conf().map_err(|_| {
|
||||||
Error::bad_config("Failed to set up trust dns resolver with system config.")
|
Error::bad_config("Failed to set up trust dns resolver with system config.")
|
||||||
})?,
|
})?,
|
||||||
@@ -219,8 +165,16 @@ impl Globals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a reqwest client which can be used to send requests.
|
/// Returns a reqwest client which can be used to send requests.
|
||||||
pub fn reqwest_client(&self) -> &reqwest::Client {
|
pub fn reqwest_client(&self) -> Result<reqwest::ClientBuilder> {
|
||||||
&self.reqwest_client
|
let mut reqwest_client_builder = reqwest::Client::builder()
|
||||||
|
.connect_timeout(Duration::from_secs(30))
|
||||||
|
.timeout(Duration::from_secs(60 * 3))
|
||||||
|
.pool_max_idle_per_host(1);
|
||||||
|
if let Some(proxy) = self.config.proxy.to_proxy()? {
|
||||||
|
reqwest_client_builder = reqwest_client_builder.proxy(proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(reqwest_client_builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
|
|||||||
@@ -113,7 +113,11 @@ where
|
|||||||
//*reqwest_request.timeout_mut() = Some(Duration::from_secs(5));
|
//*reqwest_request.timeout_mut() = Some(Duration::from_secs(5));
|
||||||
|
|
||||||
let url = reqwest_request.url().clone();
|
let url = reqwest_request.url().clone();
|
||||||
let response = globals.reqwest_client().execute(reqwest_request).await;
|
let response = globals
|
||||||
|
.reqwest_client()?
|
||||||
|
.build()?
|
||||||
|
.execute(reqwest_request)
|
||||||
|
.await;
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(mut response) => {
|
Ok(mut response) => {
|
||||||
|
|||||||
+282
-186
@@ -1,40 +1,39 @@
|
|||||||
use std::{
|
mod edus;
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
|
||||||
convert::{TryFrom, TryInto},
|
|
||||||
mem::size_of,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use lru_cache::LruCache;
|
pub use edus::RoomEdus;
|
||||||
use member::MembershipState;
|
use member::MembershipState;
|
||||||
|
|
||||||
|
use crate::{pdu::PduBuilder, server_server, utils, Database, Error, PduEvent, Result};
|
||||||
|
use lru_cache::LruCache;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use ring::digest;
|
use ring::digest;
|
||||||
use rocket::http::RawStr;
|
use rocket::http::RawStr;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{client::error::ErrorKind, federation},
|
api::{client::error::ErrorKind, federation},
|
||||||
EventId,
|
|
||||||
events::{
|
events::{
|
||||||
AnyStrippedStateEvent, AnySyncStateEvent,
|
ignored_user_list, push_rules,
|
||||||
EventType,
|
room::{
|
||||||
ignored_user_list, push_rules, room::{
|
|
||||||
create::CreateEventContent, member, message, power_levels::PowerLevelsEventContent,
|
create::CreateEventContent, member, message, power_levels::PowerLevelsEventContent,
|
||||||
},
|
},
|
||||||
|
AnyStrippedStateEvent, AnySyncStateEvent, EventType,
|
||||||
},
|
},
|
||||||
push::{self, Action, Tweak},
|
push::{self, Action, Tweak},
|
||||||
RoomAliasId,
|
serde::{CanonicalJsonObject, CanonicalJsonValue, Raw},
|
||||||
RoomId, RoomVersionId, serde::{CanonicalJsonObject, CanonicalJsonValue, Raw}, ServerName, state_res::{self, RoomVersion, StateMap}, uint, UserId,
|
state_res::{self, RoomVersion, StateMap},
|
||||||
|
uint, EventId, RoomAliasId, RoomId, RoomVersionId, ServerName, UserId,
|
||||||
|
};
|
||||||
|
use std::{
|
||||||
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
|
convert::{TryFrom, TryInto},
|
||||||
|
mem::size_of,
|
||||||
|
sync::{Arc, Mutex, RwLock},
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
use tokio::sync::MutexGuard;
|
use tokio::sync::MutexGuard;
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
|
||||||
pub use edus::RoomEdus;
|
|
||||||
|
|
||||||
use crate::{Database, Error, pdu::PduBuilder, PduEvent, Result, utils};
|
|
||||||
|
|
||||||
use super::{abstraction::Tree, admin::AdminCommand, pusher};
|
use super::{abstraction::Tree, admin::AdminCommand, pusher};
|
||||||
|
|
||||||
mod edus;
|
|
||||||
|
|
||||||
/// The unique identifier of each state group.
|
/// The unique identifier of each state group.
|
||||||
///
|
///
|
||||||
/// This is created when a state group is added to the database by
|
/// This is created when a state group is added to the database by
|
||||||
@@ -60,6 +59,7 @@ pub struct Rooms {
|
|||||||
pub(super) userroomid_joined: Arc<dyn Tree>,
|
pub(super) userroomid_joined: Arc<dyn Tree>,
|
||||||
pub(super) roomuserid_joined: Arc<dyn Tree>,
|
pub(super) roomuserid_joined: Arc<dyn Tree>,
|
||||||
pub(super) roomid_joinedcount: Arc<dyn Tree>,
|
pub(super) roomid_joinedcount: Arc<dyn Tree>,
|
||||||
|
pub(super) roomid_invitedcount: Arc<dyn Tree>,
|
||||||
pub(super) roomuseroncejoinedids: Arc<dyn Tree>,
|
pub(super) roomuseroncejoinedids: Arc<dyn Tree>,
|
||||||
pub(super) userroomid_invitestate: Arc<dyn Tree>, // InviteState = Vec<Raw<Pdu>>
|
pub(super) userroomid_invitestate: Arc<dyn Tree>, // InviteState = Vec<Raw<Pdu>>
|
||||||
pub(super) roomuserid_invitecount: Arc<dyn Tree>, // InviteCount = Count
|
pub(super) roomuserid_invitecount: Arc<dyn Tree>, // InviteCount = Count
|
||||||
@@ -71,6 +71,7 @@ pub struct Rooms {
|
|||||||
|
|
||||||
/// Remember the current state hash of a room.
|
/// Remember the current state hash of a room.
|
||||||
pub(super) roomid_shortstatehash: Arc<dyn Tree>,
|
pub(super) roomid_shortstatehash: Arc<dyn Tree>,
|
||||||
|
pub(super) roomsynctoken_shortstatehash: Arc<dyn Tree>,
|
||||||
/// Remember the state hash at events in the past.
|
/// Remember the state hash at events in the past.
|
||||||
pub(super) shorteventid_shortstatehash: Arc<dyn Tree>,
|
pub(super) shorteventid_shortstatehash: Arc<dyn Tree>,
|
||||||
/// StateKey = EventType + StateKey, ShortStateKey = Count
|
/// StateKey = EventType + StateKey, ShortStateKey = Count
|
||||||
@@ -85,19 +86,23 @@ pub struct Rooms {
|
|||||||
pub(super) statehash_shortstatehash: Arc<dyn Tree>,
|
pub(super) statehash_shortstatehash: Arc<dyn Tree>,
|
||||||
pub(super) shortstatehash_statediff: Arc<dyn Tree>, // StateDiff = parent (or 0) + (shortstatekey+shorteventid++) + 0_u64 + (shortstatekey+shorteventid--)
|
pub(super) shortstatehash_statediff: Arc<dyn Tree>, // StateDiff = parent (or 0) + (shortstatekey+shorteventid++) + 0_u64 + (shortstatekey+shorteventid--)
|
||||||
|
|
||||||
|
pub(super) shorteventid_authchain: Arc<dyn Tree>,
|
||||||
|
|
||||||
/// RoomId + EventId -> outlier PDU.
|
/// RoomId + EventId -> outlier PDU.
|
||||||
/// Any pdu that has passed the steps 1-8 in the incoming event /federation/send/txn.
|
/// Any pdu that has passed the steps 1-8 in the incoming event /federation/send/txn.
|
||||||
pub(super) eventid_outlierpdu: Arc<dyn Tree>,
|
pub(super) eventid_outlierpdu: Arc<dyn Tree>,
|
||||||
|
pub(super) softfailedeventids: Arc<dyn Tree>,
|
||||||
|
|
||||||
/// RoomId + EventId -> Parent PDU EventId.
|
/// RoomId + EventId -> Parent PDU EventId.
|
||||||
pub(super) referencedevents: Arc<dyn Tree>,
|
pub(super) referencedevents: Arc<dyn Tree>,
|
||||||
|
|
||||||
pub(super) pdu_cache: Mutex<LruCache<EventId, Arc<PduEvent>>>,
|
pub(super) pdu_cache: Mutex<LruCache<EventId, Arc<PduEvent>>>,
|
||||||
pub(super) auth_chain_cache: Mutex<LruCache<Vec<u64>, HashSet<u64>>>,
|
pub(super) shorteventid_cache: Mutex<LruCache<u64, Arc<EventId>>>,
|
||||||
pub(super) shorteventid_cache: Mutex<LruCache<u64, EventId>>,
|
pub(super) auth_chain_cache: Mutex<LruCache<Vec<u64>, Arc<HashSet<u64>>>>,
|
||||||
pub(super) eventidshort_cache: Mutex<LruCache<EventId, u64>>,
|
pub(super) eventidshort_cache: Mutex<LruCache<EventId, u64>>,
|
||||||
pub(super) statekeyshort_cache: Mutex<LruCache<(EventType, String), u64>>,
|
pub(super) statekeyshort_cache: Mutex<LruCache<(EventType, String), u64>>,
|
||||||
pub(super) shortstatekey_cache: Mutex<LruCache<u64, (EventType, String)>>,
|
pub(super) shortstatekey_cache: Mutex<LruCache<u64, (EventType, String)>>,
|
||||||
|
pub(super) our_real_users_cache: RwLock<HashMap<RoomId, Arc<HashSet<UserId>>>>,
|
||||||
pub(super) stateinfo_cache: Mutex<
|
pub(super) stateinfo_cache: Mutex<
|
||||||
LruCache<
|
LruCache<
|
||||||
u64,
|
u64,
|
||||||
@@ -115,7 +120,7 @@ impl Rooms {
|
|||||||
/// Builds a StateMap by iterating over all keys that start
|
/// Builds a StateMap by iterating over all keys that start
|
||||||
/// with state_hash, this gives the full state for the given state_hash.
|
/// with state_hash, this gives the full state for the given state_hash.
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn state_full_ids(&self, shortstatehash: u64) -> Result<BTreeMap<u64, EventId>> {
|
pub fn state_full_ids(&self, shortstatehash: u64) -> Result<BTreeMap<u64, Arc<EventId>>> {
|
||||||
let full_state = self
|
let full_state = self
|
||||||
.load_shortstatehash_info(shortstatehash)?
|
.load_shortstatehash_info(shortstatehash)?
|
||||||
.pop()
|
.pop()
|
||||||
@@ -166,7 +171,7 @@ impl Rooms {
|
|||||||
shortstatehash: u64,
|
shortstatehash: u64,
|
||||||
event_type: &EventType,
|
event_type: &EventType,
|
||||||
state_key: &str,
|
state_key: &str,
|
||||||
) -> Result<Option<EventId>> {
|
) -> Result<Option<Arc<EventId>>> {
|
||||||
let shortstatekey = match self.get_shortstatekey(event_type, state_key)? {
|
let shortstatekey = match self.get_shortstatekey(event_type, state_key)? {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
None => return Ok(None),
|
None => return Ok(None),
|
||||||
@@ -423,7 +428,7 @@ impl Rooms {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.update_joined_count(room_id)?;
|
self.update_joined_count(room_id, &db)?;
|
||||||
|
|
||||||
self.roomid_shortstatehash
|
self.roomid_shortstatehash
|
||||||
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
|
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
|
||||||
@@ -522,7 +527,7 @@ impl Rooms {
|
|||||||
pub fn parse_compressed_state_event(
|
pub fn parse_compressed_state_event(
|
||||||
&self,
|
&self,
|
||||||
compressed_event: CompressedStateEvent,
|
compressed_event: CompressedStateEvent,
|
||||||
) -> Result<(u64, EventId)> {
|
) -> Result<(u64, Arc<EventId>)> {
|
||||||
Ok((
|
Ok((
|
||||||
utils::u64_from_bytes(&compressed_event[0..size_of::<u64>()])
|
utils::u64_from_bytes(&compressed_event[0..size_of::<u64>()])
|
||||||
.expect("bytes have right length"),
|
.expect("bytes have right length"),
|
||||||
@@ -838,14 +843,14 @@ impl Rooms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn get_eventid_from_short(&self, shorteventid: u64) -> Result<EventId> {
|
pub fn get_eventid_from_short(&self, shorteventid: u64) -> Result<Arc<EventId>> {
|
||||||
if let Some(id) = self
|
if let Some(id) = self
|
||||||
.shorteventid_cache
|
.shorteventid_cache
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_mut(&shorteventid)
|
.get_mut(&shorteventid)
|
||||||
{
|
{
|
||||||
return Ok(id.clone());
|
return Ok(Arc::clone(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
let bytes = self
|
let bytes = self
|
||||||
@@ -853,15 +858,17 @@ impl Rooms {
|
|||||||
.get(&shorteventid.to_be_bytes())?
|
.get(&shorteventid.to_be_bytes())?
|
||||||
.ok_or_else(|| Error::bad_database("Shorteventid does not exist"))?;
|
.ok_or_else(|| Error::bad_database("Shorteventid does not exist"))?;
|
||||||
|
|
||||||
let event_id = EventId::try_from(utils::string_from_bytes(&bytes).map_err(|_| {
|
let event_id = Arc::new(
|
||||||
Error::bad_database("EventID in shorteventid_eventid is invalid unicode.")
|
EventId::try_from(utils::string_from_bytes(&bytes).map_err(|_| {
|
||||||
})?)
|
Error::bad_database("EventID in shorteventid_eventid is invalid unicode.")
|
||||||
.map_err(|_| Error::bad_database("EventId in shorteventid_eventid is invalid."))?;
|
})?)
|
||||||
|
.map_err(|_| Error::bad_database("EventId in shorteventid_eventid is invalid."))?,
|
||||||
|
);
|
||||||
|
|
||||||
self.shorteventid_cache
|
self.shorteventid_cache
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.insert(shorteventid, event_id.clone());
|
.insert(shorteventid, Arc::clone(&event_id));
|
||||||
|
|
||||||
Ok(event_id)
|
Ok(event_id)
|
||||||
}
|
}
|
||||||
@@ -928,7 +935,7 @@ impl Rooms {
|
|||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
event_type: &EventType,
|
event_type: &EventType,
|
||||||
state_key: &str,
|
state_key: &str,
|
||||||
) -> Result<Option<EventId>> {
|
) -> Result<Option<Arc<EventId>>> {
|
||||||
if let Some(current_shortstatehash) = self.current_shortstatehash(room_id)? {
|
if let Some(current_shortstatehash) = self.current_shortstatehash(room_id)? {
|
||||||
self.state_get_id(current_shortstatehash, event_type, state_key)
|
self.state_get_id(current_shortstatehash, event_type, state_key)
|
||||||
} else {
|
} else {
|
||||||
@@ -1225,9 +1232,19 @@ impl Rooms {
|
|||||||
self.eventid_outlierpdu.insert(
|
self.eventid_outlierpdu.insert(
|
||||||
&event_id.as_bytes(),
|
&event_id.as_bytes(),
|
||||||
&serde_json::to_vec(&pdu).expect("CanonicalJsonObject is valid"),
|
&serde_json::to_vec(&pdu).expect("CanonicalJsonObject is valid"),
|
||||||
)?;
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn mark_event_soft_failed(&self, event_id: &EventId) -> Result<()> {
|
||||||
|
self.softfailedeventids.insert(&event_id.as_bytes(), &[])
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn is_event_soft_failed(&self, event_id: &EventId) -> Result<bool> {
|
||||||
|
self.softfailedeventids
|
||||||
|
.get(&event_id.as_bytes())
|
||||||
|
.map(|o| o.is_some())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new persisted data unit and adds it to a room.
|
/// Creates a new persisted data unit and adds it to a room.
|
||||||
@@ -1330,15 +1347,9 @@ impl Rooms {
|
|||||||
let mut notifies = Vec::new();
|
let mut notifies = Vec::new();
|
||||||
let mut highlights = Vec::new();
|
let mut highlights = Vec::new();
|
||||||
|
|
||||||
for user in db
|
for user in self.get_our_real_users(&pdu.room_id, db)?.iter() {
|
||||||
.rooms
|
|
||||||
.room_members(&pdu.room_id)
|
|
||||||
.filter_map(|r| r.ok())
|
|
||||||
.filter(|user_id| user_id.server_name() == db.globals.server_name())
|
|
||||||
.filter(|user_id| !db.users.is_deactivated(user_id).unwrap_or(true))
|
|
||||||
{
|
|
||||||
// Don't notify the user of their own events
|
// Don't notify the user of their own events
|
||||||
if user == pdu.sender {
|
if user == &pdu.sender {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1514,6 +1525,85 @@ impl Rooms {
|
|||||||
"list_appservices" => {
|
"list_appservices" => {
|
||||||
db.admin.send(AdminCommand::ListAppservices);
|
db.admin.send(AdminCommand::ListAppservices);
|
||||||
}
|
}
|
||||||
|
"get_auth_chain" => {
|
||||||
|
if args.len() == 1 {
|
||||||
|
if let Ok(event_id) = EventId::try_from(args[0]) {
|
||||||
|
let start = Instant::now();
|
||||||
|
let count = server_server::get_auth_chain(
|
||||||
|
vec![Arc::new(event_id)],
|
||||||
|
db,
|
||||||
|
)?
|
||||||
|
.count();
|
||||||
|
let elapsed = start.elapsed();
|
||||||
|
db.admin.send(AdminCommand::SendMessage(
|
||||||
|
message::MessageEventContent::text_plain(format!(
|
||||||
|
"Loaded auth chain with length {} in {:?}",
|
||||||
|
count, elapsed
|
||||||
|
)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"parse_pdu" => {
|
||||||
|
if body.len() > 2
|
||||||
|
&& body[0].trim() == "```"
|
||||||
|
&& body.last().unwrap().trim() == "```"
|
||||||
|
{
|
||||||
|
let string = body[1..body.len() - 1].join("\n");
|
||||||
|
match serde_json::from_str(&string) {
|
||||||
|
Ok(value) => {
|
||||||
|
let event_id = EventId::try_from(&*format!(
|
||||||
|
"${}",
|
||||||
|
// Anything higher than version3 behaves the same
|
||||||
|
ruma::signatures::reference_hash(
|
||||||
|
&value,
|
||||||
|
&RoomVersionId::Version6
|
||||||
|
)
|
||||||
|
.expect("ruma can calculate reference hashes")
|
||||||
|
))
|
||||||
|
.expect(
|
||||||
|
"ruma's reference hashes are valid event ids",
|
||||||
|
);
|
||||||
|
|
||||||
|
match serde_json::from_value::<PduEvent>(
|
||||||
|
serde_json::to_value(value)
|
||||||
|
.expect("value is json"),
|
||||||
|
) {
|
||||||
|
Ok(pdu) => {
|
||||||
|
db.admin.send(AdminCommand::SendMessage(
|
||||||
|
message::MessageEventContent::text_plain(
|
||||||
|
format!("EventId: {:?}\n{:#?}", event_id, pdu),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
db.admin.send(AdminCommand::SendMessage(
|
||||||
|
message::MessageEventContent::text_plain(
|
||||||
|
format!("EventId: {:?}\nCould not parse event: {}", event_id, e),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
db.admin.send(AdminCommand::SendMessage(
|
||||||
|
message::MessageEventContent::text_plain(
|
||||||
|
format!(
|
||||||
|
"Invalid json in command body: {}",
|
||||||
|
e
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
db.admin.send(AdminCommand::SendMessage(
|
||||||
|
message::MessageEventContent::text_plain(
|
||||||
|
"Expected code block in command body.",
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
"get_pdu" => {
|
"get_pdu" => {
|
||||||
if args.len() == 1 {
|
if args.len() == 1 {
|
||||||
if let Ok(event_id) = EventId::try_from(args[0]) {
|
if let Ok(event_id) = EventId::try_from(args[0]) {
|
||||||
@@ -1535,7 +1625,7 @@ impl Rooms {
|
|||||||
if outlier {
|
if outlier {
|
||||||
"PDU is outlier"
|
"PDU is outlier"
|
||||||
} else { "PDU was accepted"}, json_text),
|
} else { "PDU was accepted"}, json_text),
|
||||||
format!("<p>{}</p>\n<pre><code class=\"language-json\">{}\n</code></pre>\n",
|
format!("<p>{}</p>\n<pre><code class=\"language-json\">{}\n</code></pre>\n",
|
||||||
if outlier {
|
if outlier {
|
||||||
"PDU is outlier"
|
"PDU is outlier"
|
||||||
} else { "PDU was accepted"}, RawStr::new(&json_text).html_escape())
|
} else { "PDU was accepted"}, RawStr::new(&json_text).html_escape())
|
||||||
@@ -1802,6 +1892,38 @@ impl Rooms {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn associate_token_shortstatehash(
|
||||||
|
&self,
|
||||||
|
room_id: &RoomId,
|
||||||
|
token: u64,
|
||||||
|
shortstatehash: u64,
|
||||||
|
) -> Result<()> {
|
||||||
|
let shortroomid = self.get_shortroomid(room_id)?.expect("room exists");
|
||||||
|
|
||||||
|
let mut key = shortroomid.to_be_bytes().to_vec();
|
||||||
|
key.extend_from_slice(&token.to_be_bytes());
|
||||||
|
|
||||||
|
self.roomsynctoken_shortstatehash
|
||||||
|
.insert(&key, &shortstatehash.to_be_bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_token_shortstatehash(&self, room_id: &RoomId, token: u64) -> Result<Option<u64>> {
|
||||||
|
let shortroomid = self.get_shortroomid(room_id)?.expect("room exists");
|
||||||
|
|
||||||
|
let mut key = shortroomid.to_be_bytes().to_vec();
|
||||||
|
key.extend_from_slice(&token.to_be_bytes());
|
||||||
|
|
||||||
|
Ok(self
|
||||||
|
.roomsynctoken_shortstatehash
|
||||||
|
.get(&key)?
|
||||||
|
.map(|bytes| {
|
||||||
|
utils::u64_from_bytes(&bytes).map_err(|_| {
|
||||||
|
Error::bad_database("Invalid shortstatehash in roomsynctoken_shortstatehash")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.transpose()?)
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a new persisted data unit and adds it to a room.
|
/// Creates a new persisted data unit and adds it to a room.
|
||||||
#[tracing::instrument(skip(self, db, _mutex_lock))]
|
#[tracing::instrument(skip(self, db, _mutex_lock))]
|
||||||
pub fn build_and_append_pdu(
|
pub fn build_and_append_pdu(
|
||||||
@@ -2388,29 +2510,45 @@ impl Rooms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if update_joined_count {
|
if update_joined_count {
|
||||||
self.update_joined_count(room_id)?;
|
self.update_joined_count(room_id, db)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self, room_id, db))]
|
||||||
pub fn update_joined_count(&self, room_id: &RoomId) -> Result<()> {
|
pub fn update_joined_count(&self, room_id: &RoomId, db: &Database) -> Result<()> {
|
||||||
let mut joinedcount = 0_u64;
|
let mut joinedcount = 0_u64;
|
||||||
|
let mut invitedcount = 0_u64;
|
||||||
let mut joined_servers = HashSet::new();
|
let mut joined_servers = HashSet::new();
|
||||||
|
let mut real_users = HashSet::new();
|
||||||
|
|
||||||
for joined in self.room_members(&room_id).filter_map(|r| r.ok()) {
|
for joined in self.room_members(&room_id).filter_map(|r| r.ok()) {
|
||||||
joined_servers.insert(joined.server_name().to_owned());
|
joined_servers.insert(joined.server_name().to_owned());
|
||||||
|
if joined.server_name() == db.globals.server_name()
|
||||||
|
&& !db.users.is_deactivated(&joined).unwrap_or(true)
|
||||||
|
{
|
||||||
|
real_users.insert(joined);
|
||||||
|
}
|
||||||
joinedcount += 1;
|
joinedcount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for invited in self.room_members_invited(&room_id).filter_map(|r| r.ok()) {
|
for invited in self.room_members_invited(&room_id).filter_map(|r| r.ok()) {
|
||||||
joined_servers.insert(invited.server_name().to_owned());
|
joined_servers.insert(invited.server_name().to_owned());
|
||||||
|
invitedcount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.roomid_joinedcount
|
self.roomid_joinedcount
|
||||||
.insert(room_id.as_bytes(), &joinedcount.to_be_bytes())?;
|
.insert(room_id.as_bytes(), &joinedcount.to_be_bytes())?;
|
||||||
|
|
||||||
|
self.roomid_invitedcount
|
||||||
|
.insert(room_id.as_bytes(), &invitedcount.to_be_bytes())?;
|
||||||
|
|
||||||
|
self.our_real_users_cache
|
||||||
|
.write()
|
||||||
|
.unwrap()
|
||||||
|
.insert(room_id.clone(), Arc::new(real_users));
|
||||||
|
|
||||||
for old_joined_server in self.room_servers(room_id).filter_map(|r| r.ok()) {
|
for old_joined_server in self.room_servers(room_id).filter_map(|r| r.ok()) {
|
||||||
if !joined_servers.remove(&old_joined_server) {
|
if !joined_servers.remove(&old_joined_server) {
|
||||||
// Server not in room anymore
|
// Server not in room anymore
|
||||||
@@ -2444,6 +2582,32 @@ impl Rooms {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self, room_id, db))]
|
||||||
|
pub fn get_our_real_users(
|
||||||
|
&self,
|
||||||
|
room_id: &RoomId,
|
||||||
|
db: &Database,
|
||||||
|
) -> Result<Arc<HashSet<UserId>>> {
|
||||||
|
let maybe = self
|
||||||
|
.our_real_users_cache
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.get(room_id)
|
||||||
|
.cloned();
|
||||||
|
if let Some(users) = maybe {
|
||||||
|
Ok(users)
|
||||||
|
} else {
|
||||||
|
self.update_joined_count(room_id, &db)?;
|
||||||
|
Ok(Arc::clone(
|
||||||
|
self.our_real_users_cache
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.get(room_id)
|
||||||
|
.unwrap(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, db))]
|
#[tracing::instrument(skip(self, db))]
|
||||||
pub async fn leave_room(
|
pub async fn leave_room(
|
||||||
&self,
|
&self,
|
||||||
@@ -2922,6 +3086,18 @@ impl Rooms {
|
|||||||
.transpose()?)
|
.transpose()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn room_invited_count(&self, room_id: &RoomId) -> Result<Option<u64>> {
|
||||||
|
Ok(self
|
||||||
|
.roomid_invitedcount
|
||||||
|
.get(room_id.as_bytes())?
|
||||||
|
.map(|b| {
|
||||||
|
utils::u64_from_bytes(&b)
|
||||||
|
.map_err(|_| Error::bad_database("Invalid joinedcount in db."))
|
||||||
|
})
|
||||||
|
.transpose()?)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns an iterator over all User IDs who ever joined a room.
|
/// Returns an iterator over all User IDs who ever joined a room.
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn room_useroncejoined<'a>(
|
pub fn room_useroncejoined<'a>(
|
||||||
@@ -3168,144 +3344,64 @@ impl Rooms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn auth_chain_cache(&self) -> std::sync::MutexGuard<'_, LruCache<Vec<u64>, HashSet<u64>>> {
|
pub fn get_auth_chain_from_cache<'a>(
|
||||||
self.auth_chain_cache.lock().unwrap()
|
&'a self,
|
||||||
|
key: &[u64],
|
||||||
|
) -> Result<Option<Arc<HashSet<u64>>>> {
|
||||||
|
// Check RAM cache
|
||||||
|
if let Some(result) = self.auth_chain_cache.lock().unwrap().get_mut(key) {
|
||||||
|
return Ok(Some(Arc::clone(result)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check DB cache
|
||||||
|
if key.len() == 1 {
|
||||||
|
if let Some(chain) =
|
||||||
|
self.shorteventid_authchain
|
||||||
|
.get(&key[0].to_be_bytes())?
|
||||||
|
.map(|chain| {
|
||||||
|
chain
|
||||||
|
.chunks_exact(size_of::<u64>())
|
||||||
|
.map(|chunk| {
|
||||||
|
utils::u64_from_bytes(chunk).expect("byte length is correct")
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
{
|
||||||
|
let chain = Arc::new(chain);
|
||||||
|
|
||||||
|
// Cache in RAM
|
||||||
|
self.auth_chain_cache
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.insert(vec![key[0]], Arc::clone(&chain));
|
||||||
|
|
||||||
|
return Ok(Some(chain));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn cache_auth_chain(&self, key: Vec<u64>, chain: Arc<HashSet<u64>>) -> Result<()> {
|
||||||
|
// Persist in db
|
||||||
|
if key.len() == 1 {
|
||||||
|
self.shorteventid_authchain.insert(
|
||||||
|
&key[0].to_be_bytes(),
|
||||||
|
&chain
|
||||||
|
.iter()
|
||||||
|
.map(|s| s.to_be_bytes().to_vec())
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<u8>>(),
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache in RAM
|
||||||
|
self.auth_chain_cache
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.insert(key.clone(), chain);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_size_of_caches() {
|
|
||||||
let stateinfo_cache: LruCache<
|
|
||||||
u64,
|
|
||||||
Vec<(
|
|
||||||
u64, // sstatehash
|
|
||||||
HashSet<CompressedStateEvent>, // full state
|
|
||||||
HashSet<CompressedStateEvent>, // added
|
|
||||||
HashSet<CompressedStateEvent>, // removed
|
|
||||||
)>,
|
|
||||||
> = LruCache::new(1_000);
|
|
||||||
|
|
||||||
let mut total_max_cache_size: i32 = 0;
|
|
||||||
|
|
||||||
{
|
|
||||||
let pdu_cache: LruCache<EventId, Arc<PduEvent>> = LruCache::new(100_000);
|
|
||||||
let content_json = r#"
|
|
||||||
{
|
|
||||||
"body": "> <@fusetim:matrix.org> with my toaster, sure xd\n\nFor people with smaller machines, I can recomend gitpod. It is integrated with GitLab and gives you a quite powerful machine (see screenshot below) with vscode in the browser.",
|
|
||||||
"format": "org.matrix.custom.html",
|
|
||||||
"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!pWCROeqlZcGggueJLt:fachschaften.org/$2Slj7obNBkOLVOiF5nhNLIRI7-gWLY6lc0F75ERJAmI?via=conduit.rs&via=matrix.org&via=privacytools.io\">In reply to</a> <a href=\"https://matrix.to/#/@fusetim:matrix.org\">@fusetim:matrix.org</a><br>with my toaster, sure xd</blockquote></mx-reply>For people with smaller machines, I can recomend gitpod. It is integrated with GitLab and gives you a quite powerful machine (see screenshot below) with vscode in the browser.",
|
|
||||||
"m.relates_to": {
|
|
||||||
"m.in_reply_to": {
|
|
||||||
"event_id": "$2Slj7obNBkOLVOiF5nhNLIRI7-gWLY6lc0F75ERJAmI"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"msgtype": "m.text"
|
|
||||||
}"#;
|
|
||||||
|
|
||||||
let pdu_event = PduEvent {
|
|
||||||
event_id: EventId::try_from(format!("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk"))
|
|
||||||
.unwrap(),
|
|
||||||
room_id: RoomId::try_from("!n8f893n9:example.com").unwrap(),
|
|
||||||
sender: UserId::try_from("@carl:example.com").unwrap(),
|
|
||||||
origin_server_ts: uint!(400),
|
|
||||||
kind: EventType::Dummy,
|
|
||||||
content: serde_json::from_str(content_json).unwrap(),
|
|
||||||
auth_events: Vec::new(),
|
|
||||||
state_key: Some("#################################".to_string()),
|
|
||||||
prev_events: Vec::new(),
|
|
||||||
depth: uint!(400),
|
|
||||||
redacts: None,
|
|
||||||
unsigned: BTreeMap::default(),
|
|
||||||
hashes: ruma::events::pdu::EventHash::new(
|
|
||||||
"################################################################".to_string(),
|
|
||||||
),
|
|
||||||
signatures: BTreeMap::default(),
|
|
||||||
};
|
|
||||||
let pdu_event_size = std::mem::size_of_val(&pdu_event);
|
|
||||||
|
|
||||||
let event_id =
|
|
||||||
EventId::try_from(format!("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk")).unwrap();
|
|
||||||
let event_id_size = std::mem::size_of_val(&event_id);
|
|
||||||
|
|
||||||
let total_pdu_mem = &pdu_cache.capacity() * (pdu_event_size + event_id_size);
|
|
||||||
let pdu_cache_size_in_mb =
|
|
||||||
(std::mem::size_of_val(&pdu_cache) + total_pdu_mem) as i32 / 100_000 as i32;
|
|
||||||
|
|
||||||
total_max_cache_size += pdu_cache_size_in_mb;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"size of filled ({}) pdu_cache is {} MB",
|
|
||||||
&pdu_cache.capacity(),
|
|
||||||
pdu_cache_size_in_mb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let auth_chain_cache: LruCache<u64, HashSet<u64>> = LruCache::new(100_000);
|
|
||||||
|
|
||||||
let mut a_hash_set: HashSet<u64> = HashSet::new();
|
|
||||||
a_hash_set.insert(100_000 as u64);
|
|
||||||
a_hash_set.insert(200_000 as u64);
|
|
||||||
a_hash_set.insert(300_000 as u64);
|
|
||||||
|
|
||||||
let entry_size = std::mem::size_of::<u64>() + std::mem::size_of_val(&a_hash_set);
|
|
||||||
let all_entry_sizes = &auth_chain_cache.capacity() * entry_size;
|
|
||||||
|
|
||||||
let auth_chain_cache_size_in_mb =
|
|
||||||
(std::mem::size_of_val(&auth_chain_cache) + all_entry_sizes) as i32 / 100_000 as i32;
|
|
||||||
|
|
||||||
|
|
||||||
total_max_cache_size += auth_chain_cache_size_in_mb;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"size of filled ({}) auth_chain_cache is {} MB",
|
|
||||||
&auth_chain_cache.capacity(),
|
|
||||||
auth_chain_cache_size_in_mb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let shorteventid_cache: LruCache<u64, EventId> = LruCache::new(1_000_000);
|
|
||||||
|
|
||||||
let event_id =
|
|
||||||
EventId::try_from(format!("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk")).unwrap();
|
|
||||||
let event_id_size = std::mem::size_of_val(&event_id);
|
|
||||||
|
|
||||||
let entry_size = std::mem::size_of::<u64>() + event_id_size;
|
|
||||||
let all_entry_sizes = &shorteventid_cache.capacity() * entry_size;
|
|
||||||
|
|
||||||
let shorteventid_cache_size_in_mb =
|
|
||||||
(std::mem::size_of_val(&shorteventid_cache) + all_entry_sizes) as i32 / 100_000 as i32;
|
|
||||||
|
|
||||||
total_max_cache_size += shorteventid_cache_size_in_mb * 2;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"size of filled ({}) shorteventid_cache / eventidshort_cache is {} MB",
|
|
||||||
&shorteventid_cache.capacity(),
|
|
||||||
shorteventid_cache_size_in_mb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let statekeyshort_cache: LruCache<(EventType, String), u64> = LruCache::new(1_000_000);
|
|
||||||
let a_key = (EventType::Dummy, "###################################".to_string());
|
|
||||||
let a_value = "#####################################".to_string();
|
|
||||||
|
|
||||||
let entry_size = std::mem::size_of_val(&a_key) + std::mem::size_of_val(&a_value);
|
|
||||||
let all_entry_sizes = &statekeyshort_cache.capacity() * entry_size;
|
|
||||||
|
|
||||||
let statekeyshort_cache_size_in_mb =
|
|
||||||
(std::mem::size_of_val(&statekeyshort_cache) + all_entry_sizes) as i32 / 100_000 as i32;
|
|
||||||
|
|
||||||
total_max_cache_size += statekeyshort_cache_size_in_mb * 2;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"size of filled ({}) statekeyshort_cache / shortstatekey_cache is {} MB",
|
|
||||||
&statekeyshort_cache.capacity(),
|
|
||||||
statekeyshort_cache_size_in_mb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("All caches sum up to {} MB", &total_max_cache_size);
|
|
||||||
}
|
|
||||||
|
|||||||
+18
-13
@@ -84,8 +84,8 @@ pub enum SendingEventType {
|
|||||||
pub struct Sending {
|
pub struct Sending {
|
||||||
/// The state for a given state hash.
|
/// The state for a given state hash.
|
||||||
pub(super) servername_educount: Arc<dyn Tree>, // EduCount: Count of last EDU sync
|
pub(super) servername_educount: Arc<dyn Tree>, // EduCount: Count of last EDU sync
|
||||||
pub(super) servernameevent_data: Arc<dyn Tree>, // ServernamEvent = (+ / $)SenderKey / ServerName / UserId + PduId / * (for edus), Data = EDU content
|
pub(super) servernameevent_data: Arc<dyn Tree>, // ServernamEvent = (+ / $)SenderKey / ServerName / UserId + PduId / Id (for edus), Data = EDU content
|
||||||
pub(super) servercurrentevent_data: Arc<dyn Tree>, // ServerCurrentEvents = (+ / $)ServerName / UserId + PduId / * (for edus), Data = EDU content
|
pub(super) servercurrentevent_data: Arc<dyn Tree>, // ServerCurrentEvents = (+ / $)ServerName / UserId + PduId / Id (for edus), Data = EDU content
|
||||||
pub(super) maximum_requests: Arc<Semaphore>,
|
pub(super) maximum_requests: Arc<Semaphore>,
|
||||||
pub sender: mpsc::UnboundedSender<(Vec<u8>, Vec<u8>)>,
|
pub sender: mpsc::UnboundedSender<(Vec<u8>, Vec<u8>)>,
|
||||||
}
|
}
|
||||||
@@ -435,10 +435,15 @@ impl Sending {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, server, serialized))]
|
#[tracing::instrument(skip(self, server, serialized))]
|
||||||
pub fn send_reliable_edu(&self, server: &ServerName, serialized: Vec<u8>) -> Result<()> {
|
pub fn send_reliable_edu(
|
||||||
|
&self,
|
||||||
|
server: &ServerName,
|
||||||
|
serialized: Vec<u8>,
|
||||||
|
id: u64,
|
||||||
|
) -> Result<()> {
|
||||||
let mut key = server.as_bytes().to_vec();
|
let mut key = server.as_bytes().to_vec();
|
||||||
key.push(0xff);
|
key.push(0xff);
|
||||||
key.push(b'*');
|
key.extend_from_slice(&id.to_be_bytes());
|
||||||
self.servernameevent_data.insert(&key, &serialized)?;
|
self.servernameevent_data.insert(&key, &serialized)?;
|
||||||
self.sender.unbounded_send((key, serialized)).unwrap();
|
self.sender.unbounded_send((key, serialized)).unwrap();
|
||||||
|
|
||||||
@@ -714,10 +719,10 @@ impl Sending {
|
|||||||
OutgoingKind::Appservice(Box::<ServerName>::try_from(server).map_err(|_| {
|
OutgoingKind::Appservice(Box::<ServerName>::try_from(server).map_err(|_| {
|
||||||
Error::bad_database("Invalid server string in server_currenttransaction")
|
Error::bad_database("Invalid server string in server_currenttransaction")
|
||||||
})?),
|
})?),
|
||||||
if event.starts_with(b"*") {
|
if value.is_empty() {
|
||||||
SendingEventType::Edu(value)
|
|
||||||
} else {
|
|
||||||
SendingEventType::Pdu(event.to_vec())
|
SendingEventType::Pdu(event.to_vec())
|
||||||
|
} else {
|
||||||
|
SendingEventType::Edu(value)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else if key.starts_with(b"$") {
|
} else if key.starts_with(b"$") {
|
||||||
@@ -732,10 +737,10 @@ impl Sending {
|
|||||||
.ok_or_else(|| Error::bad_database("Invalid bytes in servercurrentpdus."))?;
|
.ok_or_else(|| Error::bad_database("Invalid bytes in servercurrentpdus."))?;
|
||||||
(
|
(
|
||||||
OutgoingKind::Push(user.to_vec(), pushkey.to_vec()),
|
OutgoingKind::Push(user.to_vec(), pushkey.to_vec()),
|
||||||
if event.starts_with(b"*") {
|
if value.is_empty() {
|
||||||
SendingEventType::Edu(value)
|
|
||||||
} else {
|
|
||||||
SendingEventType::Pdu(event.to_vec())
|
SendingEventType::Pdu(event.to_vec())
|
||||||
|
} else {
|
||||||
|
SendingEventType::Edu(value)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -753,10 +758,10 @@ impl Sending {
|
|||||||
OutgoingKind::Normal(Box::<ServerName>::try_from(server).map_err(|_| {
|
OutgoingKind::Normal(Box::<ServerName>::try_from(server).map_err(|_| {
|
||||||
Error::bad_database("Invalid server string in server_currenttransaction")
|
Error::bad_database("Invalid server string in server_currenttransaction")
|
||||||
})?),
|
})?),
|
||||||
if event.starts_with(b"*") {
|
if value.is_empty() {
|
||||||
SendingEventType::Edu(event[1..].to_vec())
|
|
||||||
} else {
|
|
||||||
SendingEventType::Pdu(event.to_vec())
|
SendingEventType::Pdu(event.to_vec())
|
||||||
|
} else {
|
||||||
|
SendingEventType::Edu(value)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
+244
-105
@@ -4,7 +4,7 @@ use crate::{
|
|||||||
utils, ConduitResult, Database, Error, PduEvent, Result, Ruma,
|
utils, ConduitResult, Database, Error, PduEvent, Result, Ruma,
|
||||||
};
|
};
|
||||||
use get_profile_information::v1::ProfileField;
|
use get_profile_information::v1::ProfileField;
|
||||||
use http::header::{HeaderValue, AUTHORIZATION, HOST};
|
use http::header::{HeaderValue, AUTHORIZATION};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use rocket::response::content::Json;
|
use rocket::response::content::Json;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -51,7 +51,7 @@ use ruma::{
|
|||||||
ServerSigningKeyId, UserId,
|
ServerSigningKeyId, UserId,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{btree_map, hash_map, BTreeMap, HashMap, HashSet},
|
collections::{btree_map, hash_map, BTreeMap, BTreeSet, HashMap, HashSet},
|
||||||
convert::{TryFrom, TryInto},
|
convert::{TryFrom, TryInto},
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
future::Future,
|
future::Future,
|
||||||
@@ -83,7 +83,7 @@ use rocket::{get, post, put};
|
|||||||
/// FedDest::Named("198.51.100.5".to_owned(), "".to_owned());
|
/// FedDest::Named("198.51.100.5".to_owned(), "".to_owned());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
enum FedDest {
|
pub enum FedDest {
|
||||||
Literal(SocketAddr),
|
Literal(SocketAddr),
|
||||||
Named(String, String),
|
Named(String, String),
|
||||||
}
|
}
|
||||||
@@ -109,6 +109,13 @@ impl FedDest {
|
|||||||
Self::Named(host, _) => host.clone(),
|
Self::Named(host, _) => host.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn port(&self) -> Option<u16> {
|
||||||
|
match &self {
|
||||||
|
Self::Literal(addr) => Some(addr.port()),
|
||||||
|
Self::Named(_, port) => port[1..].parse().ok(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(globals, request))]
|
#[tracing::instrument(skip(globals, request))]
|
||||||
@@ -124,41 +131,34 @@ where
|
|||||||
return Err(Error::bad_config("Federation is disabled."));
|
return Err(Error::bad_config("Federation is disabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
let maybe_result = globals
|
let mut write_destination_to_cache = false;
|
||||||
|
|
||||||
|
let cached_result = globals
|
||||||
.actual_destination_cache
|
.actual_destination_cache
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get(destination)
|
.get(destination)
|
||||||
.cloned();
|
.cloned();
|
||||||
|
|
||||||
let (actual_destination, host) = if let Some(result) = maybe_result {
|
let (actual_destination, host) = if let Some(result) = cached_result {
|
||||||
result
|
result
|
||||||
} else {
|
} else {
|
||||||
|
write_destination_to_cache = true;
|
||||||
|
|
||||||
let result = find_actual_destination(globals, &destination).await;
|
let result = find_actual_destination(globals, &destination).await;
|
||||||
let (actual_destination, host) = result.clone();
|
|
||||||
let result_string = (result.0.into_https_string(), result.1.into_uri_string());
|
(result.0, result.1.clone().into_uri_string())
|
||||||
globals
|
|
||||||
.actual_destination_cache
|
|
||||||
.write()
|
|
||||||
.unwrap()
|
|
||||||
.insert(Box::<ServerName>::from(destination), result_string.clone());
|
|
||||||
let dest_hostname = actual_destination.hostname();
|
|
||||||
let host_hostname = host.hostname();
|
|
||||||
if dest_hostname != host_hostname {
|
|
||||||
globals.tls_name_override.write().unwrap().insert(
|
|
||||||
dest_hostname,
|
|
||||||
webpki::DNSNameRef::try_from_ascii_str(&host_hostname)
|
|
||||||
.unwrap()
|
|
||||||
.to_owned(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
result_string
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let actual_destination_str = actual_destination.clone().into_https_string();
|
||||||
|
|
||||||
let mut http_request = request
|
let mut http_request = request
|
||||||
.try_into_http_request::<Vec<u8>>(&actual_destination, SendAccessToken::IfRequired(""))
|
.try_into_http_request::<Vec<u8>>(&actual_destination_str, SendAccessToken::IfRequired(""))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
warn!("Failed to find destination {}: {}", actual_destination, e);
|
warn!(
|
||||||
|
"Failed to find destination {}: {}",
|
||||||
|
actual_destination_str, e
|
||||||
|
);
|
||||||
Error::BadServerResponse("Invalid destination")
|
Error::BadServerResponse("Invalid destination")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -224,15 +224,26 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
http_request
|
|
||||||
.headers_mut()
|
|
||||||
.insert(HOST, HeaderValue::from_str(&host).unwrap());
|
|
||||||
|
|
||||||
let reqwest_request = reqwest::Request::try_from(http_request)
|
let reqwest_request = reqwest::Request::try_from(http_request)
|
||||||
.expect("all http requests are valid reqwest requests");
|
.expect("all http requests are valid reqwest requests");
|
||||||
|
|
||||||
let url = reqwest_request.url().clone();
|
let url = reqwest_request.url().clone();
|
||||||
let response = globals.reqwest_client().execute(reqwest_request).await;
|
|
||||||
|
let mut client = globals.reqwest_client()?;
|
||||||
|
if let Some((override_name, port)) = globals
|
||||||
|
.tls_name_override
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.get(&actual_destination.hostname())
|
||||||
|
{
|
||||||
|
client = client.resolve(
|
||||||
|
&actual_destination.hostname(),
|
||||||
|
SocketAddr::new(override_name[0], *port),
|
||||||
|
);
|
||||||
|
// port will be ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
let response = client.build()?.execute(reqwest_request).await;
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(mut response) => {
|
Ok(mut response) => {
|
||||||
@@ -271,6 +282,13 @@ where
|
|||||||
|
|
||||||
if status == 200 {
|
if status == 200 {
|
||||||
let response = T::IncomingResponse::try_from_http_response(http_response);
|
let response = T::IncomingResponse::try_from_http_response(http_response);
|
||||||
|
if response.is_ok() && write_destination_to_cache {
|
||||||
|
globals.actual_destination_cache.write().unwrap().insert(
|
||||||
|
Box::<ServerName>::from(destination),
|
||||||
|
(actual_destination, host),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
response.map_err(|e| {
|
response.map_err(|e| {
|
||||||
warn!(
|
warn!(
|
||||||
"Invalid 200 response from {} on: {} {}",
|
"Invalid 200 response from {} on: {} {}",
|
||||||
@@ -339,20 +357,49 @@ async fn find_actual_destination(
|
|||||||
match request_well_known(globals, &destination.as_str()).await {
|
match request_well_known(globals, &destination.as_str()).await {
|
||||||
// 3: A .well-known file is available
|
// 3: A .well-known file is available
|
||||||
Some(delegated_hostname) => {
|
Some(delegated_hostname) => {
|
||||||
hostname = delegated_hostname.clone();
|
hostname = add_port_to_hostname(&delegated_hostname).into_uri_string();
|
||||||
match get_ip_with_port(&delegated_hostname) {
|
match get_ip_with_port(&delegated_hostname) {
|
||||||
Some(host_and_port) => host_and_port, // 3.1: IP literal in .well-known file
|
Some(host_and_port) => host_and_port, // 3.1: IP literal in .well-known file
|
||||||
None => {
|
None => {
|
||||||
if let Some(pos) = destination_str.find(':') {
|
if let Some(pos) = delegated_hostname.find(':') {
|
||||||
// 3.2: Hostname with port in .well-known file
|
// 3.2: Hostname with port in .well-known file
|
||||||
let (host, port) = destination_str.split_at(pos);
|
let (host, port) = delegated_hostname.split_at(pos);
|
||||||
FedDest::Named(host.to_string(), port.to_string())
|
FedDest::Named(host.to_string(), port.to_string())
|
||||||
} else {
|
} else {
|
||||||
match query_srv_record(globals, &delegated_hostname).await {
|
// Delegated hostname has no port in this branch
|
||||||
|
if let Some(hostname_override) =
|
||||||
|
query_srv_record(globals, &delegated_hostname).await
|
||||||
|
{
|
||||||
// 3.3: SRV lookup successful
|
// 3.3: SRV lookup successful
|
||||||
Some(hostname) => hostname,
|
let force_port = hostname_override.port();
|
||||||
|
|
||||||
|
if let Ok(override_ip) = globals
|
||||||
|
.dns_resolver()
|
||||||
|
.lookup_ip(hostname_override.hostname())
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
globals.tls_name_override.write().unwrap().insert(
|
||||||
|
delegated_hostname.clone(),
|
||||||
|
(
|
||||||
|
override_ip.iter().collect(),
|
||||||
|
force_port.unwrap_or(8448),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
warn!("Using SRV record, but could not resolve to IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(port) = force_port {
|
||||||
|
FedDest::Named(
|
||||||
|
delegated_hostname,
|
||||||
|
format!(":{}", port.to_string()),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
add_port_to_hostname(&delegated_hostname)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// 3.4: No SRV records, just use the hostname from .well-known
|
// 3.4: No SRV records, just use the hostname from .well-known
|
||||||
None => add_port_to_hostname(&delegated_hostname),
|
add_port_to_hostname(&delegated_hostname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,7 +409,31 @@ async fn find_actual_destination(
|
|||||||
None => {
|
None => {
|
||||||
match query_srv_record(globals, &destination_str).await {
|
match query_srv_record(globals, &destination_str).await {
|
||||||
// 4: SRV record found
|
// 4: SRV record found
|
||||||
Some(hostname) => hostname,
|
Some(hostname_override) => {
|
||||||
|
let force_port = hostname_override.port();
|
||||||
|
|
||||||
|
if let Ok(override_ip) = globals
|
||||||
|
.dns_resolver()
|
||||||
|
.lookup_ip(hostname_override.hostname())
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
globals.tls_name_override.write().unwrap().insert(
|
||||||
|
hostname.clone(),
|
||||||
|
(override_ip.iter().collect(), force_port.unwrap_or(8448)),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
warn!("Using SRV record, but could not resolve to IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(port) = force_port {
|
||||||
|
FedDest::Named(
|
||||||
|
hostname.clone(),
|
||||||
|
format!(":{}", port.to_string()),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
add_port_to_hostname(&hostname)
|
||||||
|
}
|
||||||
|
}
|
||||||
// 5: No SRV record found
|
// 5: No SRV record found
|
||||||
None => add_port_to_hostname(&destination_str),
|
None => add_port_to_hostname(&destination_str),
|
||||||
}
|
}
|
||||||
@@ -377,12 +448,12 @@ async fn find_actual_destination(
|
|||||||
let hostname = if let Ok(addr) = hostname.parse::<SocketAddr>() {
|
let hostname = if let Ok(addr) = hostname.parse::<SocketAddr>() {
|
||||||
FedDest::Literal(addr)
|
FedDest::Literal(addr)
|
||||||
} else if let Ok(addr) = hostname.parse::<IpAddr>() {
|
} else if let Ok(addr) = hostname.parse::<IpAddr>() {
|
||||||
FedDest::Named(addr.to_string(), "".to_string())
|
FedDest::Named(addr.to_string(), ":8448".to_string())
|
||||||
} else if let Some(pos) = hostname.find(':') {
|
} else if let Some(pos) = hostname.find(':') {
|
||||||
let (host, port) = hostname.split_at(pos);
|
let (host, port) = hostname.split_at(pos);
|
||||||
FedDest::Named(host.to_string(), port.to_string())
|
FedDest::Named(host.to_string(), port.to_string())
|
||||||
} else {
|
} else {
|
||||||
FedDest::Named(hostname, "".to_string())
|
FedDest::Named(hostname, ":8448".to_string())
|
||||||
};
|
};
|
||||||
(actual_destination, hostname)
|
(actual_destination, hostname)
|
||||||
}
|
}
|
||||||
@@ -423,6 +494,9 @@ pub async fn request_well_known(
|
|||||||
let body: serde_json::Value = serde_json::from_str(
|
let body: serde_json::Value = serde_json::from_str(
|
||||||
&globals
|
&globals
|
||||||
.reqwest_client()
|
.reqwest_client()
|
||||||
|
.ok()?
|
||||||
|
.build()
|
||||||
|
.ok()?
|
||||||
.get(&format!(
|
.get(&format!(
|
||||||
"https://{}/.well-known/matrix/server",
|
"https://{}/.well-known/matrix/server",
|
||||||
destination
|
destination
|
||||||
@@ -893,7 +967,12 @@ pub async fn handle_incoming_pdu<'a>(
|
|||||||
// 9. Fetch any missing prev events doing all checks listed here starting at 1. These are timeline events
|
// 9. Fetch any missing prev events doing all checks listed here starting at 1. These are timeline events
|
||||||
let mut graph = HashMap::new();
|
let mut graph = HashMap::new();
|
||||||
let mut eventid_info = HashMap::new();
|
let mut eventid_info = HashMap::new();
|
||||||
let mut todo_outlier_stack = incoming_pdu.prev_events.clone();
|
let mut todo_outlier_stack = incoming_pdu
|
||||||
|
.prev_events
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.map(Arc::new)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut amount = 0;
|
let mut amount = 0;
|
||||||
|
|
||||||
@@ -929,13 +1008,13 @@ pub async fn handle_incoming_pdu<'a>(
|
|||||||
amount += 1;
|
amount += 1;
|
||||||
for prev_prev in &pdu.prev_events {
|
for prev_prev in &pdu.prev_events {
|
||||||
if !graph.contains_key(prev_prev) {
|
if !graph.contains_key(prev_prev) {
|
||||||
todo_outlier_stack.push(dbg!(prev_prev.clone()));
|
todo_outlier_stack.push(dbg!(Arc::new(prev_prev.clone())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.insert(
|
graph.insert(
|
||||||
prev_event_id.clone(),
|
prev_event_id.clone(),
|
||||||
pdu.prev_events.iter().cloned().collect(),
|
pdu.prev_events.iter().cloned().map(Arc::new).collect(),
|
||||||
);
|
);
|
||||||
eventid_info.insert(prev_event_id.clone(), (pdu, json));
|
eventid_info.insert(prev_event_id.clone(), (pdu, json));
|
||||||
} else {
|
} else {
|
||||||
@@ -964,9 +1043,9 @@ pub async fn handle_incoming_pdu<'a>(
|
|||||||
MilliSecondsSinceUnixEpoch(
|
MilliSecondsSinceUnixEpoch(
|
||||||
eventid_info
|
eventid_info
|
||||||
.get(event_id)
|
.get(event_id)
|
||||||
.map_or_else(|| uint!(0), |info| info.0.origin_server_ts.clone()),
|
.map_or_else(|| uint!(0), |info| info.0.origin_server_ts),
|
||||||
),
|
),
|
||||||
ruma::event_id!("$notimportant"),
|
Arc::new(ruma::event_id!("$notimportant")),
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
.map_err(|_| "Error sorting prev events".to_owned())?;
|
.map_err(|_| "Error sorting prev events".to_owned())?;
|
||||||
@@ -1084,7 +1163,12 @@ fn handle_outlier_pdu<'a>(
|
|||||||
fetch_and_handle_outliers(
|
fetch_and_handle_outliers(
|
||||||
db,
|
db,
|
||||||
origin,
|
origin,
|
||||||
&incoming_pdu.auth_events,
|
&incoming_pdu
|
||||||
|
.auth_events
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.map(Arc::new)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
&create_event,
|
&create_event,
|
||||||
&room_id,
|
&room_id,
|
||||||
pub_key_map,
|
pub_key_map,
|
||||||
@@ -1100,13 +1184,13 @@ fn handle_outlier_pdu<'a>(
|
|||||||
// Build map of auth events
|
// Build map of auth events
|
||||||
let mut auth_events = HashMap::new();
|
let mut auth_events = HashMap::new();
|
||||||
for id in &incoming_pdu.auth_events {
|
for id in &incoming_pdu.auth_events {
|
||||||
let auth_event = db
|
let auth_event = match db.rooms.get_pdu(id).map_err(|e| e.to_string())? {
|
||||||
.rooms
|
Some(e) => e,
|
||||||
.get_pdu(id)
|
None => {
|
||||||
.map_err(|e| e.to_string())?
|
warn!("Could not find auth event {}", id);
|
||||||
.ok_or_else(|| {
|
continue;
|
||||||
"Auth event not found, event failed recursive auth checks.".to_string()
|
}
|
||||||
})?;
|
};
|
||||||
|
|
||||||
match auth_events.entry((
|
match auth_events.entry((
|
||||||
auth_event.kind.clone(),
|
auth_event.kind.clone(),
|
||||||
@@ -1153,7 +1237,7 @@ fn handle_outlier_pdu<'a>(
|
|||||||
if !state_res::event_auth::auth_check(
|
if !state_res::event_auth::auth_check(
|
||||||
&room_version,
|
&room_version,
|
||||||
&incoming_pdu,
|
&incoming_pdu,
|
||||||
previous_create.clone(),
|
previous_create,
|
||||||
None, // TODO: third party invite
|
None, // TODO: third party invite
|
||||||
|k, s| auth_events.get(&(k.clone(), s.to_owned())).map(Arc::clone),
|
|k, s| auth_events.get(&(k.clone(), s.to_owned())).map(Arc::clone),
|
||||||
)
|
)
|
||||||
@@ -1187,6 +1271,15 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
if let Ok(Some(pduid)) = db.rooms.get_pdu_id(&incoming_pdu.event_id) {
|
if let Ok(Some(pduid)) = db.rooms.get_pdu_id(&incoming_pdu.event_id) {
|
||||||
return Ok(Some(pduid));
|
return Ok(Some(pduid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db
|
||||||
|
.rooms
|
||||||
|
.is_event_soft_failed(&incoming_pdu.event_id)
|
||||||
|
.map_err(|_| "Failed to ask db for soft fail".to_owned())?
|
||||||
|
{
|
||||||
|
return Err("Event has been soft failed".into());
|
||||||
|
}
|
||||||
|
|
||||||
// 10. Fetch missing state and auth chain events by calling /state_ids at backwards extremities
|
// 10. Fetch missing state and auth chain events by calling /state_ids at backwards extremities
|
||||||
// doing all the checks in this list starting at 1. These are not timeline events.
|
// doing all the checks in this list starting at 1. These are not timeline events.
|
||||||
|
|
||||||
@@ -1219,7 +1312,7 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
.get_or_create_shortstatekey(&prev_pdu.kind, state_key, &db.globals)
|
.get_or_create_shortstatekey(&prev_pdu.kind, state_key, &db.globals)
|
||||||
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
||||||
|
|
||||||
state.insert(shortstatekey, prev_event.clone());
|
state.insert(shortstatekey, Arc::new(prev_event.clone()));
|
||||||
// Now it's the state after the pdu
|
// Now it's the state after the pdu
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1249,7 +1342,11 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
let state_vec = fetch_and_handle_outliers(
|
let state_vec = fetch_and_handle_outliers(
|
||||||
&db,
|
&db,
|
||||||
origin,
|
origin,
|
||||||
&res.pdu_ids,
|
&res.pdu_ids
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.map(Arc::new)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
&create_event,
|
&create_event,
|
||||||
&room_id,
|
&room_id,
|
||||||
pub_key_map,
|
pub_key_map,
|
||||||
@@ -1270,7 +1367,7 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
|
|
||||||
match state.entry(shortstatekey) {
|
match state.entry(shortstatekey) {
|
||||||
btree_map::Entry::Vacant(v) => {
|
btree_map::Entry::Vacant(v) => {
|
||||||
v.insert(pdu.event_id.clone());
|
v.insert(Arc::new(pdu.event_id.clone()));
|
||||||
}
|
}
|
||||||
btree_map::Entry::Occupied(_) => return Err(
|
btree_map::Entry::Occupied(_) => return Err(
|
||||||
"State event's type and state_key combination exists multiple times."
|
"State event's type and state_key combination exists multiple times."
|
||||||
@@ -1286,7 +1383,9 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
.map_err(|_| "Failed to talk to db.")?
|
.map_err(|_| "Failed to talk to db.")?
|
||||||
.expect("Room exists");
|
.expect("Room exists");
|
||||||
|
|
||||||
if state.get(&create_shortstatekey) != Some(&create_event.event_id) {
|
if state.get(&create_shortstatekey).map(|id| id.as_ref())
|
||||||
|
!= Some(&create_event.event_id)
|
||||||
|
{
|
||||||
return Err("Incoming event refers to wrong create event.".to_owned());
|
return Err("Incoming event refers to wrong create event.".to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1387,6 +1486,17 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
.state_full_ids(current_sstatehash)
|
.state_full_ids(current_sstatehash)
|
||||||
.map_err(|_| "Failed to load room state.")?;
|
.map_err(|_| "Failed to load room state.")?;
|
||||||
|
|
||||||
|
let auth_events = db
|
||||||
|
.rooms
|
||||||
|
.get_auth_events(
|
||||||
|
&room_id,
|
||||||
|
&incoming_pdu.kind,
|
||||||
|
&incoming_pdu.sender,
|
||||||
|
incoming_pdu.state_key.as_deref(),
|
||||||
|
&incoming_pdu.content,
|
||||||
|
)
|
||||||
|
.map_err(|_| "Failed to get_auth_events.".to_owned())?;
|
||||||
|
|
||||||
if incoming_pdu.state_key.is_some() {
|
if incoming_pdu.state_key.is_some() {
|
||||||
let mut extremity_sstatehashes = HashMap::new();
|
let mut extremity_sstatehashes = HashMap::new();
|
||||||
|
|
||||||
@@ -1440,7 +1550,7 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
.rooms
|
.rooms
|
||||||
.get_or_create_shortstatekey(&leaf_pdu.kind, state_key, &db.globals)
|
.get_or_create_shortstatekey(&leaf_pdu.kind, state_key, &db.globals)
|
||||||
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
||||||
leaf_state.insert(shortstatekey, leaf_pdu.event_id.clone());
|
leaf_state.insert(shortstatekey, Arc::new(leaf_pdu.event_id.clone()));
|
||||||
// Now it's the state after the pdu
|
// Now it's the state after the pdu
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1455,9 +1565,9 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
.get_or_create_shortstatekey(&incoming_pdu.kind, state_key, &db.globals)
|
.get_or_create_shortstatekey(&incoming_pdu.kind, state_key, &db.globals)
|
||||||
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
.map_err(|_| "Failed to create shortstatekey.".to_owned())?;
|
||||||
|
|
||||||
state_after.insert(shortstatekey, incoming_pdu.event_id.clone());
|
state_after.insert(shortstatekey, Arc::new(incoming_pdu.event_id.clone()));
|
||||||
}
|
}
|
||||||
fork_states.push(state_after.clone());
|
fork_states.push(state_after);
|
||||||
|
|
||||||
let mut update_state = false;
|
let mut update_state = false;
|
||||||
// 14. Use state resolution to find new room state
|
// 14. Use state resolution to find new room state
|
||||||
@@ -1541,18 +1651,8 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
|
|
||||||
extremities.insert(incoming_pdu.event_id.clone());
|
extremities.insert(incoming_pdu.event_id.clone());
|
||||||
|
|
||||||
debug!("starting soft fail auth check");
|
|
||||||
// 13. Check if the event passes auth based on the "current state" of the room, if not "soft fail" it
|
// 13. Check if the event passes auth based on the "current state" of the room, if not "soft fail" it
|
||||||
let auth_events = db
|
debug!("starting soft fail auth check");
|
||||||
.rooms
|
|
||||||
.get_auth_events(
|
|
||||||
&room_id,
|
|
||||||
&incoming_pdu.kind,
|
|
||||||
&incoming_pdu.sender,
|
|
||||||
incoming_pdu.state_key.as_deref(),
|
|
||||||
&incoming_pdu.content,
|
|
||||||
)
|
|
||||||
.map_err(|_| "Failed to get_auth_events.".to_owned())?;
|
|
||||||
|
|
||||||
let soft_fail = !state_res::event_auth::auth_check(
|
let soft_fail = !state_res::event_auth::auth_check(
|
||||||
&room_version,
|
&room_version,
|
||||||
@@ -1592,6 +1692,9 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
if soft_fail {
|
if soft_fail {
|
||||||
// Soft fail, we keep the event as an outlier but don't add it to the timeline
|
// Soft fail, we keep the event as an outlier but don't add it to the timeline
|
||||||
warn!("Event was soft failed: {:?}", incoming_pdu);
|
warn!("Event was soft failed: {:?}", incoming_pdu);
|
||||||
|
db.rooms
|
||||||
|
.mark_event_soft_failed(&incoming_pdu.event_id)
|
||||||
|
.map_err(|_| "Failed to set soft failed flag".to_owned())?;
|
||||||
return Err("Event has been soft failed".into());
|
return Err("Event has been soft failed".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1613,7 +1716,7 @@ async fn upgrade_outlier_to_timeline_pdu(
|
|||||||
pub(crate) fn fetch_and_handle_outliers<'a>(
|
pub(crate) fn fetch_and_handle_outliers<'a>(
|
||||||
db: &'a Database,
|
db: &'a Database,
|
||||||
origin: &'a ServerName,
|
origin: &'a ServerName,
|
||||||
events: &'a [EventId],
|
events: &'a [Arc<EventId>],
|
||||||
create_event: &'a PduEvent,
|
create_event: &'a PduEvent,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
pub_key_map: &'a RwLock<BTreeMap<String, BTreeMap<String, String>>>,
|
pub_key_map: &'a RwLock<BTreeMap<String, BTreeMap<String, String>>>,
|
||||||
@@ -1664,20 +1767,25 @@ pub(crate) fn fetch_and_handle_outliers<'a>(
|
|||||||
{
|
{
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
warn!("Got {} over federation", id);
|
warn!("Got {} over federation", id);
|
||||||
let (event_id, value) =
|
let (calculated_event_id, value) =
|
||||||
match crate::pdu::gen_event_id_canonical_json(&res.pdu) {
|
match crate::pdu::gen_event_id_canonical_json(&res.pdu) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
back_off(id.clone());
|
back_off((**id).clone());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if calculated_event_id != **id {
|
||||||
|
warn!("Server didn't return event id we requested: requested: {}, we got {}. Event: {:?}",
|
||||||
|
id, calculated_event_id, &res.pdu);
|
||||||
|
}
|
||||||
|
|
||||||
// This will also fetch the auth chain
|
// This will also fetch the auth chain
|
||||||
match handle_outlier_pdu(
|
match handle_outlier_pdu(
|
||||||
origin,
|
origin,
|
||||||
create_event,
|
create_event,
|
||||||
&event_id,
|
&id,
|
||||||
&room_id,
|
&room_id,
|
||||||
value.clone(),
|
value.clone(),
|
||||||
db,
|
db,
|
||||||
@@ -1688,14 +1796,14 @@ pub(crate) fn fetch_and_handle_outliers<'a>(
|
|||||||
Ok((pdu, json)) => (pdu, Some(json)),
|
Ok((pdu, json)) => (pdu, Some(json)),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Authentication of event {} failed: {:?}", id, e);
|
warn!("Authentication of event {} failed: {:?}", id, e);
|
||||||
back_off(id.clone());
|
back_off((**id).clone());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
warn!("Failed to fetch event: {}", id);
|
warn!("Failed to fetch event: {}", id);
|
||||||
back_off(id.clone());
|
back_off((**id).clone());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1970,48 +2078,79 @@ fn append_incoming_pdu(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(starting_events, db))]
|
#[tracing::instrument(skip(starting_events, db))]
|
||||||
fn get_auth_chain(
|
pub fn get_auth_chain(
|
||||||
starting_events: Vec<EventId>,
|
starting_events: Vec<Arc<EventId>>,
|
||||||
db: &Database,
|
db: &Database,
|
||||||
) -> Result<impl Iterator<Item = EventId> + '_> {
|
) -> Result<impl Iterator<Item = Arc<EventId>> + '_> {
|
||||||
let mut full_auth_chain = HashSet::new();
|
const NUM_BUCKETS: usize = 50;
|
||||||
|
|
||||||
const NUM_BUCKETS: usize = 100;
|
let mut buckets = vec![BTreeSet::new(); NUM_BUCKETS];
|
||||||
|
|
||||||
let mut buckets = vec![HashSet::new(); NUM_BUCKETS];
|
|
||||||
|
|
||||||
for id in starting_events {
|
for id in starting_events {
|
||||||
let short = db.rooms.get_or_create_shorteventid(&id, &db.globals)?;
|
let short = db.rooms.get_or_create_shorteventid(&id, &db.globals)?;
|
||||||
let bucket_id = (short % NUM_BUCKETS as u64) as usize;
|
let bucket_id = (short % NUM_BUCKETS as u64) as usize;
|
||||||
buckets[bucket_id].insert((short, id));
|
buckets[bucket_id].insert((short, id.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut cache = db.rooms.auth_chain_cache();
|
let mut full_auth_chain = HashSet::new();
|
||||||
|
|
||||||
|
let mut hits = 0;
|
||||||
|
let mut misses = 0;
|
||||||
for chunk in buckets {
|
for chunk in buckets {
|
||||||
let chunk_key = chunk.iter().map(|(short, _)| short).copied().collect();
|
if chunk.is_empty() {
|
||||||
if let Some(cached) = cache.get_mut(&chunk_key) {
|
|
||||||
full_auth_chain.extend(cached.iter().cloned());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let chunk_key = chunk
|
||||||
|
.iter()
|
||||||
|
.map(|(short, _)| short)
|
||||||
|
.copied()
|
||||||
|
.collect::<Vec<u64>>();
|
||||||
|
if let Some(cached) = db.rooms.get_auth_chain_from_cache(&chunk_key)? {
|
||||||
|
hits += 1;
|
||||||
|
full_auth_chain.extend(cached.iter().cloned());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
misses += 1;
|
||||||
|
|
||||||
let mut chunk_cache = HashSet::new();
|
let mut chunk_cache = HashSet::new();
|
||||||
|
let mut hits2 = 0;
|
||||||
|
let mut misses2 = 0;
|
||||||
for (sevent_id, event_id) in chunk {
|
for (sevent_id, event_id) in chunk {
|
||||||
if let Some(cached) = cache.get_mut(&[sevent_id][..]) {
|
if let Some(cached) = db.rooms.get_auth_chain_from_cache(&[sevent_id])? {
|
||||||
|
hits2 += 1;
|
||||||
chunk_cache.extend(cached.iter().cloned());
|
chunk_cache.extend(cached.iter().cloned());
|
||||||
} else {
|
} else {
|
||||||
drop(cache);
|
misses2 += 1;
|
||||||
let auth_chain = get_auth_chain_inner(&event_id, db)?;
|
let auth_chain = Arc::new(get_auth_chain_inner(&event_id, db)?);
|
||||||
cache = db.rooms.auth_chain_cache();
|
db.rooms
|
||||||
cache.insert(vec![sevent_id], auth_chain.clone());
|
.cache_auth_chain(vec![sevent_id], Arc::clone(&auth_chain))?;
|
||||||
chunk_cache.extend(auth_chain);
|
println!(
|
||||||
|
"cache missed event {} with auth chain len {}",
|
||||||
|
event_id,
|
||||||
|
auth_chain.len()
|
||||||
|
);
|
||||||
|
chunk_cache.extend(auth_chain.iter());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
cache.insert(chunk_key, chunk_cache.clone());
|
println!(
|
||||||
full_auth_chain.extend(chunk_cache);
|
"chunk missed with len {}, event hits2: {}, misses2: {}",
|
||||||
|
chunk_cache.len(),
|
||||||
|
hits2,
|
||||||
|
misses2
|
||||||
|
);
|
||||||
|
let chunk_cache = Arc::new(chunk_cache);
|
||||||
|
db.rooms
|
||||||
|
.cache_auth_chain(chunk_key, Arc::clone(&chunk_cache))?;
|
||||||
|
full_auth_chain.extend(chunk_cache.iter());
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(cache);
|
println!(
|
||||||
|
"total: {}, chunk hits: {}, misses: {}",
|
||||||
|
full_auth_chain.len(),
|
||||||
|
hits,
|
||||||
|
misses
|
||||||
|
);
|
||||||
|
|
||||||
Ok(full_auth_chain
|
Ok(full_auth_chain
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -2136,12 +2275,12 @@ pub fn get_event_authorization_route(
|
|||||||
return Err(Error::bad_config("Federation is disabled."));
|
return Err(Error::bad_config("Federation is disabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
let auth_chain_ids = get_auth_chain(vec![body.event_id.clone()], &db)?;
|
let auth_chain_ids = get_auth_chain(vec![Arc::new(body.event_id.clone())], &db)?;
|
||||||
|
|
||||||
Ok(get_event_authorization::v1::Response {
|
Ok(get_event_authorization::v1::Response {
|
||||||
auth_chain: auth_chain_ids
|
auth_chain: auth_chain_ids
|
||||||
.filter_map(|id| Some(db.rooms.get_pdu_json(&id).ok()??))
|
.filter_map(|id| db.rooms.get_pdu_json(&id).ok()?)
|
||||||
.map(|event| PduEvent::convert_to_outgoing_federation_event(event))
|
.map(PduEvent::convert_to_outgoing_federation_event)
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
.into())
|
.into())
|
||||||
@@ -2179,7 +2318,7 @@ pub fn get_room_state_route(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let auth_chain_ids = get_auth_chain(vec![body.event_id.clone()], &db)?;
|
let auth_chain_ids = get_auth_chain(vec![Arc::new(body.event_id.clone())], &db)?;
|
||||||
|
|
||||||
Ok(get_room_state::v1::Response {
|
Ok(get_room_state::v1::Response {
|
||||||
auth_chain: auth_chain_ids
|
auth_chain: auth_chain_ids
|
||||||
@@ -2220,13 +2359,13 @@ pub fn get_room_state_ids_route(
|
|||||||
.rooms
|
.rooms
|
||||||
.state_full_ids(shortstatehash)?
|
.state_full_ids(shortstatehash)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(_, id)| id)
|
.map(|(_, id)| (*id).clone())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let auth_chain_ids = get_auth_chain(vec![body.event_id.clone()], &db)?;
|
let auth_chain_ids = get_auth_chain(vec![Arc::new(body.event_id.clone())], &db)?;
|
||||||
|
|
||||||
Ok(get_room_state_ids::v1::Response {
|
Ok(get_room_state_ids::v1::Response {
|
||||||
auth_chain_ids: auth_chain_ids.collect(),
|
auth_chain_ids: auth_chain_ids.map(|id| (*id).clone()).collect(),
|
||||||
pdu_ids,
|
pdu_ids,
|
||||||
}
|
}
|
||||||
.into())
|
.into())
|
||||||
|
|||||||
Reference in New Issue
Block a user