mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Tweaks
This commit is contained in:
parent
56e980782b
commit
68ef3b5502
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue