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 Cache caching.RoomServerCaches
ServerName gomatrixserverlib.ServerName ServerName gomatrixserverlib.ServerName
KeyRing gomatrixserverlib.JSONVerifier KeyRing gomatrixserverlib.JSONVerifier
ACLs *acls.ServerACLs
fsAPI fsAPI.FederationInternalAPI fsAPI fsAPI.FederationInternalAPI
asAPI asAPI.AppServiceQueryAPI asAPI asAPI.AppServiceQueryAPI
OutputRoomEventTopic string // Kafka topic for new output room events OutputRoomEventTopic string // Kafka topic for new output room events
@ -55,6 +56,8 @@ func NewRoomserverAPI(
Cache: caches, Cache: caches,
ServerName: cfg.Matrix.ServerName, ServerName: cfg.Matrix.ServerName,
PerspectiveServerNames: perspectiveServerNames, PerspectiveServerNames: perspectiveServerNames,
ACLs: serverACLs,
Producer: producer,
Queryer: &query.Queryer{ Queryer: &query.Queryer{
DB: roomserverDB, DB: roomserverDB,
Cache: caches, 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 // Then check if the prev events are known, which we need in order
// to calculate the state before the event. // to calculate the state before the event.
if err := r.checkForMissingAuthEvents(ctx, input); err != nil { if err := r.checkForMissingPrevEvents(ctx, input); err != nil {
return "", fmt.Errorf("r.checkForMissingAuthEvents: %w", err) return "", fmt.Errorf("r.checkForMissingPrevEvents: %w", err)
} }
var softfail bool var softfail bool
@ -251,11 +251,15 @@ func (r *Inputer) checkForMissingAuthEvents(
return nil return nil
} }
logrus.Printf("XXX: Auth event IDs: %+v", authEventIDs)
knownAuthEventNIDs, err := r.DB.EventNIDs(ctx, authEventIDs) knownAuthEventNIDs, err := r.DB.EventNIDs(ctx, authEventIDs)
if err != nil { if err != nil {
return fmt.Errorf("r.DB.EventNIDs: %w", err) 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)) missingAuthEventIDs := make([]string, 0, len(authEventIDs)-len(knownAuthEventNIDs))
for _, authEventID := range authEventIDs { for _, authEventID := range authEventIDs {
if _, ok := knownAuthEventNIDs[authEventID]; !ok { 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 { if len(missingAuthEventIDs) > 0 {
req := &fedapi.QueryEventAuthFromFederationRequest{ req := &fedapi.QueryEventAuthFromFederationRequest{
RoomID: input.Event.RoomID(), RoomID: input.Event.RoomID(),