Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
9f8c45c7
Unverified
Commit
9f8c45c7
authored
3 years ago
by
Timo Kösters
Browse files
Options
Downloads
Patches
Plain Diff
fix: e2ee over federation
to device events were not being sent
parent
5aa56b92
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/client_server/to_device.rs
+1
-0
1 addition, 0 deletions
src/client_server/to_device.rs
src/database/sending.rs
+18
-13
18 additions, 13 deletions
src/database/sending.rs
with
19 additions
and
13 deletions
src/client_server/to_device.rs
+
1
−
0
View file @
9f8c45c7
...
...
@@ -56,6 +56,7 @@ pub async fn send_event_to_device_route(
},
))
.expect
(
"DirectToDevice EDU can be serialized"
),
db
.globals
.next_count
()
?
,
)
?
;
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/database/sending.rs
+
18
−
13
View file @
9f8c45c7
...
...
@@ -84,8 +84,8 @@ pub enum SendingEventType {
pub
struct
Sending
{
/// The state for a given state hash.
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
)
servercurrentevent_data
:
Arc
<
dyn
Tree
>
,
// ServerCurrentEvents = (+ / $)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 /
Id
(for edus), Data = EDU content
pub
(
super
)
maximum_requests
:
Arc
<
Semaphore
>
,
pub
sender
:
mpsc
::
UnboundedSender
<
(
Vec
<
u8
>
,
Vec
<
u8
>
)
>
,
}
...
...
@@ -435,10 +435,15 @@ pub fn send_pdu(&self, server: &ServerName, pdu_id: &[u8]) -> Result<()> {
}
#[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
();
key
.push
(
0xff
);
key
.
push
(
b'*'
);
key
.
extend_from_slice
(
&
id
.to_be_bytes
()
);
self
.servernameevent_data
.insert
(
&
key
,
&
serialized
)
?
;
self
.sender
.unbounded_send
((
key
,
serialized
))
.unwrap
();
...
...
@@ -714,10 +719,10 @@ fn parse_servercurrentevent(
OutgoingKind
::
Appservice
(
Box
::
<
ServerName
>
::
try_from
(
server
)
.map_err
(|
_
|
{
Error
::
bad_database
(
"Invalid server string in server_currenttransaction"
)
})
?
),
if
event
.starts_with
(
b"*"
)
{
SendingEventType
::
Edu
(
value
)
}
else
{
if
value
.is_empty
()
{
SendingEventType
::
Pdu
(
event
.to_vec
())
}
else
{
SendingEventType
::
Edu
(
value
)
},
)
}
else
if
key
.starts_with
(
b"$"
)
{
...
...
@@ -732,10 +737,10 @@ fn parse_servercurrentevent(
.ok_or_else
(||
Error
::
bad_database
(
"Invalid bytes in servercurrentpdus."
))
?
;
(
OutgoingKind
::
Push
(
user
.to_vec
(),
pushkey
.to_vec
()),
if
event
.starts_with
(
b"*"
)
{
SendingEventType
::
Edu
(
value
)
}
else
{
if
value
.is_empty
()
{
SendingEventType
::
Pdu
(
event
.to_vec
())
}
else
{
SendingEventType
::
Edu
(
value
)
},
)
}
else
{
...
...
@@ -753,10 +758,10 @@ fn parse_servercurrentevent(
OutgoingKind
::
Normal
(
Box
::
<
ServerName
>
::
try_from
(
server
)
.map_err
(|
_
|
{
Error
::
bad_database
(
"Invalid server string in server_currenttransaction"
)
})
?
),
if
event
.starts_with
(
b"*"
)
{
SendingEventType
::
Edu
(
event
[
1
..
]
.to_vec
())
}
else
{
if
value
.is_empty
()
{
SendingEventType
::
Pdu
(
event
.to_vec
())
}
else
{
SendingEventType
::
Edu
(
value
)
},
)
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment