diff options
Diffstat (limited to 'LibMatrix/Services/HomeserverProviderService.cs')
-rw-r--r-- | LibMatrix/Services/HomeserverProviderService.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs index 5ac47f1..7a13816 100644 --- a/LibMatrix/Services/HomeserverProviderService.cs +++ b/LibMatrix/Services/HomeserverProviderService.cs @@ -47,9 +47,9 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger sem.Release(); throw; } - + try { - if (clientVersions.UnstableFeatures.TryGetValue("gay.rory.mxapiextensions.v0", out bool a) && a) + if (clientVersions.UnstableFeatures.TryGetValue("gay.rory.mxapiextensions.v0", out var a) && a) hs = await AuthenticatedHomeserverGeneric.Create<AuthenticatedHomeserverMxApiExtended>(homeserver, accessToken, proxy); else { if (serverVersion is { Server.Name: "Synapse" }) @@ -64,11 +64,13 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger throw; } - if(impersonatedMxid is not null) + if (impersonatedMxid is not null) await hs.SetImpersonate(impersonatedMxid); - - lock (AuthenticatedHomeserverCache) + + lock (AuthenticatedHomeserverCache) { AuthenticatedHomeserverCache[cacheKey] = hs; + } + sem.Release(); return hs; @@ -88,10 +90,12 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger hs = await RemoteHomeserver.Create(homeserver, proxy); - lock (RemoteHomeserverCache) + lock (RemoteHomeserverCache) { RemoteHomeserverCache[cacheKey] = hs; + } + sem.Release(); - + return hs; } |