Return early from federated room join

This commit is contained in:
Neil Alexander 2020-09-22 09:30:47 +01:00
parent 45de9dc1c0
commit a3e401e5dd
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -186,13 +186,20 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
}
r.statistics.ForServer(serverName).Success()
go func() {
ctx = context.Background()
// Check that the send_join response was valid.
joinCtx := perform.JoinContext(r.federation, r.keyRing)
respState, err := joinCtx.CheckSendJoinResponse(
ctx, event, serverName, respMakeJoin, respSendJoin,
)
if err != nil {
return fmt.Errorf("joinCtx.CheckSendJoinResponse: %w", err)
logrus.WithFields(logrus.Fields{
"room_id": roomID,
"user_id": userID,
}).WithError(err).Error("Failed to process room join response")
return
}
// If we successfully performed a send_join above then the other
@ -204,8 +211,13 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
event.Headered(respMakeJoin.RoomVersion),
nil,
); err != nil {
return fmt.Errorf("r.producer.SendEventWithState: %w", err)
logrus.WithFields(logrus.Fields{
"room_id": roomID,
"user_id": userID,
}).WithError(err).Error("Failed to send room join response to roomserver")
return
}
}()
return nil
}