From 11f588b0d603517be2c0509335c88b85b88f91f8 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 25 Nov 2021 11:18:01 +0000 Subject: Fixes for multiple Pinecone peers --- build/gobind-pinecone/monolith.go | 6 +++--- build/gobind-yggdrasil/monolith.go | 2 +- cmd/dendrite-demo-pinecone/conn/client.go | 2 +- cmd/dendrite-demo-pinecone/main.go | 7 +++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build/gobind-pinecone/monolith.go b/build/gobind-pinecone/monolith.go index cd2809e4..9c739db3 100644 --- a/build/gobind-pinecone/monolith.go +++ b/build/gobind-pinecone/monolith.go @@ -76,7 +76,7 @@ func (m *DendriteMonolith) BaseURL() string { } func (m *DendriteMonolith) PeerCount(peertype int) int { - return m.PineconeRouter.PeerCount(pineconeRouter.ConnectionPeerType(peertype)) + return m.PineconeRouter.PeerCount(peertype) } func (m *DendriteMonolith) SessionCount() int { @@ -209,7 +209,7 @@ func (m *DendriteMonolith) staticPeerConnect() { return } for k := range connected { - connected[k] = false + delete(connected, k) } for _, uri := range strings.Split(uri, ",") { connected[strings.TrimSpace(uri)] = false @@ -289,7 +289,7 @@ func (m *DendriteMonolith) Start() { cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-syncapi.db", m.StorageDirectory, prefix)) cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-roomserver.db", m.StorageDirectory, prefix)) cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-keyserver.db", m.StorageDirectory, prefix)) - cfg.FederationAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-federationapi.db", m.StorageDirectory, prefix)) + cfg.FederationAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-federationsender.db", m.StorageDirectory, prefix)) cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/%s-appservice.db", m.StorageDirectory, prefix)) cfg.MediaAPI.BasePath = config.Path(fmt.Sprintf("%s/media", m.CacheDirectory)) cfg.MediaAPI.AbsBasePath = config.Path(fmt.Sprintf("%s/media", m.CacheDirectory)) diff --git a/build/gobind-yggdrasil/monolith.go b/build/gobind-yggdrasil/monolith.go index bde9fbdf..07fcf836 100644 --- a/build/gobind-yggdrasil/monolith.go +++ b/build/gobind-yggdrasil/monolith.go @@ -94,7 +94,7 @@ func (m *DendriteMonolith) Start() { cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-syncapi.db", m.StorageDirectory)) cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-roomserver.db", m.StorageDirectory)) cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-keyserver.db", m.StorageDirectory)) - cfg.FederationAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-federationapi.db", m.StorageDirectory)) + cfg.FederationAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-federationsender.db", m.StorageDirectory)) cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-appservice.db", m.StorageDirectory)) cfg.MediaAPI.BasePath = config.Path(fmt.Sprintf("%s/tmp", m.StorageDirectory)) cfg.MediaAPI.AbsBasePath = config.Path(fmt.Sprintf("%s/tmp", m.StorageDirectory)) diff --git a/cmd/dendrite-demo-pinecone/conn/client.go b/cmd/dendrite-demo-pinecone/conn/client.go index 14b648a3..e3cc0468 100644 --- a/cmd/dendrite-demo-pinecone/conn/client.go +++ b/cmd/dendrite-demo-pinecone/conn/client.go @@ -37,7 +37,7 @@ func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) error { _, err := pRouter.Connect( parent, pineconeRouter.ConnectionZone("static"), - pineconeRouter.PeerTypeRemote, + pineconeRouter.ConnectionPeerType(pineconeRouter.PeerTypeRemote), pineconeRouter.ConnectionURI(peer), ) return err diff --git a/cmd/dendrite-demo-pinecone/main.go b/cmd/dendrite-demo-pinecone/main.go index 8ed3f349..cc7238ea 100644 --- a/cmd/dendrite-demo-pinecone/main.go +++ b/cmd/dendrite-demo-pinecone/main.go @@ -110,7 +110,10 @@ func main() { continue } - port, err := pRouter.Connect(conn, pineconeRouter.PeerTypeRemote) + port, err := pRouter.Connect( + conn, + pineconeRouter.ConnectionPeerType(pineconeRouter.PeerTypeRemote), + ) if err != nil { logrus.WithError(err).Error("pSwitch.Connect failed") continue @@ -242,7 +245,7 @@ func main() { if _, err = pRouter.Connect( conn, pineconeRouter.ConnectionZone("websocket"), - pineconeRouter.PeerTypeRemote, + pineconeRouter.ConnectionPeerType(pineconeRouter.PeerTypeRemote), ); err != nil { logrus.WithError(err).Error("Failed to connect WebSocket peer to Pinecone switch") } -- cgit v1.2.3