Actually we don't really need a goroutine here

This commit is contained in:
Neil Alexander 2022-02-02 17:09:42 +00:00
parent 1e8b19d50c
commit 05f4d342f7
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -211,7 +211,7 @@ func (r *FederationInternalAPI) performJoinUsingServer(
// Sanity-check the join response to ensure that it has a create // Sanity-check the join response to ensure that it has a create
// event, that the room version is known, etc. // event, that the room version is known, etc.
if err := sanityCheckAuthChain(respSendJoin.AuthEvents); err != nil { if err = sanityCheckAuthChain(respSendJoin.AuthEvents); err != nil {
return fmt.Errorf("sanityCheckAuthChain: %w", err) return fmt.Errorf("sanityCheckAuthChain: %w", err)
} }
@ -220,38 +220,34 @@ func (r *FederationInternalAPI) performJoinUsingServer(
// to complete, but if the client does give up waiting, we'll // to complete, but if the client does give up waiting, we'll
// still continue to process the join anyway so that we don't // still continue to process the join anyway so that we don't
// waste the effort. // waste the effort.
go func() { // TODO: Can we expand Check here to return a list of missing auth
// TODO: Can we expand Check here to return a list of missing auth // events rather than failing one at a time?
// events rather than failing one at a time? var respState *gomatrixserverlib.RespState
respState, err := respSendJoin.Check(context.Background(), r.keyRing, event, federatedAuthProvider(ctx, r.federation, r.keyRing, serverName)) respState, err = respSendJoin.Check(
if err != nil { context.Background(),
logrus.WithFields(logrus.Fields{ r.keyRing,
"room_id": roomID, event,
"user_id": userID, federatedAuthProvider(ctx, r.federation, r.keyRing, serverName),
}).WithError(err).Error("Failed to process room join response") )
return if err != nil {
} return fmt.Errorf("respSendJoin.Check: %w", err)
}
// If we successfully performed a send_join above then the other // If we successfully performed a send_join above then the other
// server now thinks we're a part of the room. Send the newly // server now thinks we're a part of the room. Send the newly
// returned state to the roomserver to update our local view. // returned state to the roomserver to update our local view.
if err = roomserverAPI.SendEventWithState( if err = roomserverAPI.SendEventWithState(
context.Background(), context.Background(),
r.rsAPI, r.rsAPI,
roomserverAPI.KindNew, roomserverAPI.KindNew,
respState, respState,
event.Headered(respMakeJoin.RoomVersion), event.Headered(respMakeJoin.RoomVersion),
serverName, serverName,
nil, nil,
false, false,
); err != nil { ); err != nil {
logrus.WithFields(logrus.Fields{ return fmt.Errorf("roomserverAPI.SendEventWithState: %w", err)
"room_id": roomID, }
"user_id": userID,
}).WithError(err).Error("Failed to send room join response to roomserver")
return
}
}()
return nil return nil
} }