This commit is contained in:
Neil Alexander 2021-12-08 17:49:26 +00:00
parent 8cd5fd4849
commit 645e3f5833
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 11 additions and 2 deletions

View file

@ -37,6 +37,7 @@ type RoomserverInternalAPI struct {
Cache caching.RoomServerCaches
ServerName gomatrixserverlib.ServerName
KeyRing gomatrixserverlib.JSONVerifier
ACLs *acls.ServerACLs
fsAPI fsAPI.FederationInternalAPI
asAPI asAPI.AppServiceQueryAPI
OutputRoomEventTopic string // Kafka topic for new output room events
@ -55,6 +56,8 @@ func NewRoomserverAPI(
Cache: caches,
ServerName: cfg.Matrix.ServerName,
PerspectiveServerNames: perspectiveServerNames,
ACLs: serverACLs,
Producer: producer,
Queryer: &query.Queryer{
DB: roomserverDB,
Cache: caches,

View file

@ -116,8 +116,8 @@ func (r *Inputer) processRoomEvent(
// Then check if the prev events are known, which we need in order
// to calculate the state before the event.
if err := r.checkForMissingAuthEvents(ctx, input); err != nil {
return "", fmt.Errorf("r.checkForMissingAuthEvents: %w", err)
if err := r.checkForMissingPrevEvents(ctx, input); err != nil {
return "", fmt.Errorf("r.checkForMissingPrevEvents: %w", err)
}
var softfail bool
@ -251,11 +251,15 @@ func (r *Inputer) checkForMissingAuthEvents(
return nil
}
logrus.Printf("XXX: Auth event IDs: %+v", authEventIDs)
knownAuthEventNIDs, err := r.DB.EventNIDs(ctx, authEventIDs)
if err != nil {
return fmt.Errorf("r.DB.EventNIDs: %w", err)
}
logrus.Printf("XXX: Known auth event IDs: %+v", knownAuthEventNIDs)
missingAuthEventIDs := make([]string, 0, len(authEventIDs)-len(knownAuthEventNIDs))
for _, authEventID := range authEventIDs {
if _, ok := knownAuthEventNIDs[authEventID]; !ok {
@ -263,6 +267,8 @@ func (r *Inputer) checkForMissingAuthEvents(
}
}
logrus.Printf("XXX: Missing auth event IDs: %+v", missingAuthEventIDs)
if len(missingAuthEventIDs) > 0 {
req := &fedapi.QueryEventAuthFromFederationRequest{
RoomID: input.Event.RoomID(),