mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-03 22:52:47 +00:00
refactor: update GMSL (#3058)
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
This commit is contained in:
parent
9fa39263c0
commit
72285b2659
306 changed files with 2117 additions and 1934 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/gomatrixserverlib/fclient"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
|
@ -42,15 +43,15 @@ func (p *parsedRespState) Events() []*gomatrixserverlib.Event {
|
|||
|
||||
type missingStateReq struct {
|
||||
log *logrus.Entry
|
||||
virtualHost gomatrixserverlib.ServerName
|
||||
origin gomatrixserverlib.ServerName
|
||||
virtualHost spec.ServerName
|
||||
origin spec.ServerName
|
||||
db storage.RoomDatabase
|
||||
roomInfo *types.RoomInfo
|
||||
inputer *Inputer
|
||||
keys gomatrixserverlib.JSONVerifier
|
||||
federation fedapi.RoomserverFederationAPI
|
||||
roomsMu *internal.MutexByRoom
|
||||
servers []gomatrixserverlib.ServerName
|
||||
servers []spec.ServerName
|
||||
hadEvents map[string]bool
|
||||
hadEventsMutex sync.Mutex
|
||||
haveEvents map[string]*gomatrixserverlib.Event
|
||||
|
@ -279,7 +280,7 @@ func (t *missingStateReq) lookupResolvedStateBeforeEvent(ctx context.Context, e
|
|||
resolvedState := &parsedRespState{}
|
||||
switch len(states) {
|
||||
case 0:
|
||||
extremityIsCreate := e.Type() == gomatrixserverlib.MRoomCreate && e.StateKeyEquals("")
|
||||
extremityIsCreate := e.Type() == spec.MRoomCreate && e.StateKeyEquals("")
|
||||
if !extremityIsCreate {
|
||||
// There are no previous states and this isn't the beginning of the
|
||||
// room - this is an error condition!
|
||||
|
@ -291,7 +292,7 @@ func (t *missingStateReq) lookupResolvedStateBeforeEvent(ctx context.Context, e
|
|||
// use it as-is. There's no point in resolving it again. Only trust a
|
||||
// trustworthy state snapshot if it actually contains some state for all
|
||||
// non-create events, otherwise we need to resolve what came from federation.
|
||||
isCreate := e.Type() == gomatrixserverlib.MRoomCreate && e.StateKeyEquals("")
|
||||
isCreate := e.Type() == spec.MRoomCreate && e.StateKeyEquals("")
|
||||
if states[0].trustworthy && (isCreate || len(states[0].StateEvents) > 0) {
|
||||
resolvedState = states[0].parsedRespState
|
||||
break
|
||||
|
@ -597,7 +598,7 @@ Event:
|
|||
|
||||
// If we retrieved back to the beginning of the room then there's nothing else
|
||||
// to do - we closed the gap.
|
||||
if len(earliestNewEvent.PrevEventIDs()) == 0 && earliestNewEvent.Type() == gomatrixserverlib.MRoomCreate && earliestNewEvent.StateKeyEquals("") {
|
||||
if len(earliestNewEvent.PrevEventIDs()) == 0 && earliestNewEvent.Type() == spec.MRoomCreate && earliestNewEvent.StateKeyEquals("") {
|
||||
return newEvents, true, t.isPrevStateKnown(ctx, e), nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue