Try to handle federated joins for restricted rooms

This commit is contained in:
Neil Alexander 2021-11-02 15:09:08 +00:00
parent 237dd1045f
commit 9a38db199f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 172 additions and 1 deletions

View file

@ -149,6 +149,11 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
supportedVersions,
)
if err != nil {
// A well-formed HTTP error response that isn't in the 500s isn't fatal,
// so we shouldn't punish the server by backing off.
if httpErr, ok := err.(gomatrix.HTTPError); ok && httpErr.Code < 500 {
return fmt.Errorf("HTTP error %d: %s", httpErr.Code, httpErr.Message)
}
// TODO: Check if the user was not allowed to join the room.
r.statistics.ForServer(serverName).Failure()
return fmt.Errorf("r.federation.MakeJoin: %w", err)