From d72542f2b6fcae6ad22f6daaafd1fe6f0f68d68b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 5 Jul 2021 09:45:02 +0100 Subject: [PATCH] Revert "Remove processEventWithMissingStateMutex" This reverts commit 7f02eab47d9f62132c4fee50f190088b70763e83. --- federationapi/routing/send.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index 7c2576ab6..fcfedfeb4 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -700,9 +700,14 @@ func checkAllowedByState(e *gomatrixserverlib.Event, stateEvents []*gomatrixserv return gomatrixserverlib.Allowed(e, &authUsingState) } +var processEventWithMissingStateMutexes = internal.NewMutexByRoom() + func (t *txnReq) processEventWithMissingState( ctx context.Context, e *gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion, ) error { + processEventWithMissingStateMutexes.Lock(e.RoomID()) + defer processEventWithMissingStateMutexes.Unlock(e.RoomID()) + // We are missing the previous events for this events. // This means that there is a gap in our view of the history of the // room. There two ways that we can handle such a gap: