This commit is contained in:
Neil Alexander 2020-05-04 13:16:43 +01:00
parent 56e980782b
commit 68ef3b5502
2 changed files with 8 additions and 15 deletions

View file

@ -130,8 +130,8 @@ func MakeJoin(
}
// SendJoin implements the /send_join API
// TODO: Is there a way to break this function up in a way that actually
// makes sense?
// The make-join send-join dance makes much more sense as a single
// flow so the cyclomatic complexity is high:
// nolint:gocyclo
func SendJoin(
httpReq *http.Request,

View file

@ -49,7 +49,6 @@ func (r *FederationSenderInternalAPI) PerformJoin(
// Try each server that we were provided until we land on one that
// successfully completes the make-join send-join dance.
succeeded := false
for _, serverName := range request.ServerNames {
// Try to perform a make_join using the information supplied in the
// request.
@ -138,21 +137,15 @@ func (r *FederationSenderInternalAPI) PerformJoin(
}
// We're all good.
succeeded = true
break
return nil
}
if succeeded {
// Everything went to plan.
return nil
} else {
// We didn't complete a join for some reason.
// If we reach here then we didn't complete a join for some reason.
return fmt.Errorf(
"failed to join user %q to room %q through %d server(s)",
request.UserID, request.RoomID, len(request.ServerNames),
)
}
}
// PerformLeaveRequest implements api.FederationSenderInternalAPI
func (r *FederationSenderInternalAPI) PerformLeave(