From 53787d539d5c309809b4e89f4328bbaaa95518cf Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Tue, 25 Apr 2023 12:38:27 -0600 Subject: [PATCH] Handle new FederationError type in PerformJoin --- federationapi/internal/perform.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/federationapi/internal/perform.go b/federationapi/internal/perform.go index aa02a129c..d3c164afd 100644 --- a/federationapi/internal/perform.go +++ b/federationapi/internal/perform.go @@ -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