Exclude our own server name in GetJoinedHostsForRooms (#2110)

* Exclude our own servername

* Make excluding self behaviour optional
This commit is contained in:
Neil Alexander 2022-01-25 17:00:39 +00:00 committed by GitHub
parent 49a618dfe2
commit 8a1bc70524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 34 additions and 15 deletions

View file

@ -23,6 +23,7 @@ import (
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
)
// Database stores information needed by the federation sender
@ -34,7 +35,7 @@ type Database struct {
}
// NewDatabase opens a new database
func NewDatabase(dbProperties *config.DatabaseOptions, cache caching.FederationCache) (*Database, error) {
func NewDatabase(dbProperties *config.DatabaseOptions, cache caching.FederationCache, serverName gomatrixserverlib.ServerName) (*Database, error) {
var d Database
var err error
if d.db, err = sqlutil.Open(dbProperties); err != nil {
@ -88,6 +89,7 @@ func NewDatabase(dbProperties *config.DatabaseOptions, cache caching.FederationC
}
d.Database = shared.Database{
DB: d.db,
ServerName: serverName,
Cache: cache,
Writer: d.writer,
FederationJoinedHosts: joinedHosts,