diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-03-06 16:58:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 16:58:10 +0000 |
commit | 6a1111c3d44cfa6b5301fed70045b1e555d39c65 (patch) | |
tree | e7ecdd44491552fd4d1f96ea3927726d6334358b /federationapi/routing/send.go | |
parent | 87283e9de785f5153c5cf9b326d2640e202a36b3 (diff) |
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
Diffstat (limited to 'federationapi/routing/send.go')
-rw-r--r-- | federationapi/routing/send.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index 191e13ef..079e121f 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -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 |