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
|
// SendJoin implements the /send_join API
|
||||||
// TODO: Is there a way to break this function up in a way that actually
|
// The make-join send-join dance makes much more sense as a single
|
||||||
// makes sense?
|
// flow so the cyclomatic complexity is high:
|
||||||
// nolint:gocyclo
|
// nolint:gocyclo
|
||||||
func SendJoin(
|
func SendJoin(
|
||||||
httpReq *http.Request,
|
httpReq *http.Request,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ func (r *FederationSenderInternalAPI) PerformJoin(
|
||||||
|
|
||||||
// Try each server that we were provided until we land on one that
|
// Try each server that we were provided until we land on one that
|
||||||
// successfully completes the make-join send-join dance.
|
// successfully completes the make-join send-join dance.
|
||||||
succeeded := false
|
|
||||||
for _, serverName := range request.ServerNames {
|
for _, serverName := range request.ServerNames {
|
||||||
// Try to perform a make_join using the information supplied in the
|
// Try to perform a make_join using the information supplied in the
|
||||||
// request.
|
// request.
|
||||||
|
|
@ -138,20 +137,14 @@ func (r *FederationSenderInternalAPI) PerformJoin(
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're all good.
|
// We're all good.
|
||||||
succeeded = true
|
return nil
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if succeeded {
|
// If we reach here then we didn't complete a join for some reason.
|
||||||
// Everything went to plan.
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
// We didn't complete a join for some reason.
|
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"failed to join user %q to room %q through %d server(s)",
|
"failed to join user %q to room %q through %d server(s)",
|
||||||
request.UserID, request.RoomID, len(request.ServerNames),
|
request.UserID, request.RoomID, len(request.ServerNames),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PerformLeaveRequest implements api.FederationSenderInternalAPI
|
// PerformLeaveRequest implements api.FederationSenderInternalAPI
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue