Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
ce59a2fa
Commit
ce59a2fa
authored
8 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Correctly handle case of rejected events in state res
parent
633f9715
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/state.py
+16
-10
16 additions, 10 deletions
synapse/state.py
with
16 additions
and
10 deletions
synapse/state.py
+
16
−
10
View file @
ce59a2fa
...
...
@@ -507,21 +507,27 @@ def _create_auth_events_from_maps(unconflicted_state, conflicted_state, state_ma
auth_events
=
{}
for
event_ids
in
conflicted_state
.
itervalues
():
for
event_id
in
event_ids
:
keys
=
event_auth
.
auth_types_for_event
(
state_map
[
event_id
])
for
key
in
keys
:
if
key
not
in
auth_events
:
event_id
=
unconflicted_state
.
get
(
key
,
None
)
if
event_id
:
auth_events
[
key
]
=
event_id
if
event_id
in
state_map
:
keys
=
event_auth
.
auth_types_for_event
(
state_map
[
event_id
])
for
key
in
keys
:
if
key
not
in
auth_events
:
event_id
=
unconflicted_state
.
get
(
key
,
None
)
if
event_id
:
auth_events
[
key
]
=
event_id
return
auth_events
def
_resolve_with_state
(
unconflicted_state
,
conflicted_state
,
auth_events
,
state_map
):
conflicted_state
=
{
key
:
[
state_map
[
ev_id
]
for
ev_id
in
event_ids
if
ev_id
in
state_map
]
for
key
,
event_ids
in
conflicted_state
.
items
()
}
new_conflicted_state
=
{}
for
key
,
event_ids
in
conflicted_state
.
iteritems
():
events
=
[
state_map
[
ev_id
]
for
ev_id
in
event_ids
if
ev_id
in
state_map
]
if
len
(
events
)
>
1
:
new_conflicted_state
[
key
]
=
events
elif
len
(
events
)
==
1
:
unconflicted_state
[
key
]
=
events
[
0
].
event_id
conflicted_state
=
new_conflicted_state
auth_events
=
{
key
:
state_map
[
ev_id
]
...
...
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