aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-01-28 23:27:53 +0000
committerGitHub <noreply@github.com>2023-01-28 23:27:53 +0000
commit63df85db6d5bc528a784dc52e550fc64385c5f67 (patch)
tree80da0f2cbcf9f4473974e600f90f20aed9803707 /test
parent2debabf0f09bb6e55063bbaa00dfb77090789abc (diff)
Relay integration to pinecone demos (#2955)
This extends the dendrite monolith for pinecone to integrate the s&f features into the mobile apps. Also makes a few tweaks to federation queueing/statistics to make some edge cases more robust.
Diffstat (limited to 'test')
-rw-r--r--test/memory_federation_db.go31
1 files changed, 27 insertions, 4 deletions
diff --git a/test/memory_federation_db.go b/test/memory_federation_db.go
index cc9e1e8f..de0dc54e 100644
--- a/test/memory_federation_db.go
+++ b/test/memory_federation_db.go
@@ -399,6 +399,33 @@ func (d *InMemoryFederationDatabase) P2PAddRelayServersForServer(
return nil
}
+func (d *InMemoryFederationDatabase) P2PRemoveRelayServersForServer(
+ ctx context.Context,
+ serverName gomatrixserverlib.ServerName,
+ relayServers []gomatrixserverlib.ServerName,
+) error {
+ d.dbMutex.Lock()
+ defer d.dbMutex.Unlock()
+
+ if knownRelayServers, ok := d.relayServers[serverName]; ok {
+ for _, relayServer := range relayServers {
+ for i, knownRelayServer := range knownRelayServers {
+ if relayServer == knownRelayServer {
+ d.relayServers[serverName] = append(
+ d.relayServers[serverName][:i],
+ d.relayServers[serverName][i+1:]...,
+ )
+ break
+ }
+ }
+ }
+ } else {
+ d.relayServers[serverName] = relayServers
+ }
+
+ return nil
+}
+
func (d *InMemoryFederationDatabase) FetchKeys(ctx context.Context, requests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error) {
return nil, nil
}
@@ -431,10 +458,6 @@ func (d *InMemoryFederationDatabase) RemoveAllServersAssumedOffline(ctx context.
return nil
}
-func (d *InMemoryFederationDatabase) P2PRemoveRelayServersForServer(ctx context.Context, serverName gomatrixserverlib.ServerName, relayServers []gomatrixserverlib.ServerName) error {
- return nil
-}
-
func (d *InMemoryFederationDatabase) P2PRemoveAllRelayServersForServer(ctx context.Context, serverName gomatrixserverlib.ServerName) error {
return nil
}