mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
Try to recursively find auth events (to a point) if they are missing (#881)
* Try to recursively find auth events (to a point) if they are missing * Remove recursion limit for now and other review fixes * Simplify error handling for recursion * Pass room version 1 only to MakeJoin until room version support comes later
This commit is contained in:
parent
87283e9de7
commit
6a1111c3d4
4 changed files with 26 additions and 15 deletions
|
@ -211,7 +211,24 @@ func (t *txnReq) processEventWithMissingState(e gomatrixserverlib.Event) error {
|
|||
return err
|
||||
}
|
||||
// Check that the event is allowed by the state.
|
||||
retryAllowedState:
|
||||
if err := checkAllowedByState(e, state.StateEvents); err != nil {
|
||||
switch missing := err.(type) {
|
||||
case gomatrixserverlib.MissingAuthEventError:
|
||||
// An auth event was missing so let's look up that event over federation
|
||||
for _, s := range state.StateEvents {
|
||||
if s.EventID() != missing.AuthEventID {
|
||||
continue
|
||||
}
|
||||
err = t.processEventWithMissingState(s)
|
||||
// If there was no error retrieving the event from federation then
|
||||
// we assume that it succeeded, so retry the original state check
|
||||
if err == nil {
|
||||
goto retryAllowedState
|
||||
}
|
||||
}
|
||||
default:
|
||||
}
|
||||
return err
|
||||
}
|
||||
// pass the event along with the state to the roomserver
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue