diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-09 16:32:46 +0100 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-09 16:32:46 +0100 |
commit | 4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch) | |
tree | 6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Services/HomeserverProviderService.cs | |
parent | Consistently use EventId for event types (diff) | |
download | LibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz |
Apply syntax style to LibMatrix
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; } |