Handle new FederationError type in PerformJoin

This commit is contained in:
Devon Hudson 2023-04-25 12:38:27 -06:00
parent 1e174e04eb
commit 53787d539d
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628

View file

@ -161,19 +161,17 @@ func (r *FederationInternalAPI) performJoinUsingServer(
KeyRing: r.keyRing,
EventProvider: federatedEventProvider(ctx, r.federation, r.keyRing, user.Domain(), serverName),
}
callbacks := fclient.PerformJoinCallbacks{
FederationFailure: func(server spec.ServerName) {
r.statistics.ForServer(server).Failure()
},
FederationSuccess: func(server spec.ServerName) {
r.statistics.ForServer(server).Success(statistics.SendDirect)
},
}
response, joinErr := fclient.PerformJoin(ctx, r.federation, joinInput)
response, err := fclient.PerformJoin(ctx, r.federation, joinInput, callbacks)
if err != nil {
if !joinErr.Reachable {
r.statistics.ForServer(joinErr.ServerName).Failure()
} else {
r.statistics.ForServer(joinErr.ServerName).Success(statistics.SendDirect)
}
return err
}
r.statistics.ForServer(serverName).Success(statistics.SendDirect)
// We need to immediately update our list of joined hosts for this room now as we are technically
// joined. We must do this synchronously: we cannot rely on the roomserver output events as they