From 645e3f583323c5d4239b20bee005622abf58b5b5 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 8 Dec 2021 17:49:26 +0000 Subject: [PATCH] Tweaks --- roomserver/internal/api.go | 3 +++ roomserver/internal/input/input_events.go | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/roomserver/internal/api.go b/roomserver/internal/api.go index 2feef38b..0a7f3291 100644 --- a/roomserver/internal/api.go +++ b/roomserver/internal/api.go @@ -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, diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 0c182bb1..b647a86d 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -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(),