about summary refs log tree commit diff
path: root/LibMatrix/Services/HomeserverResolverService.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
commit4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch)
tree6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Services/HomeserverResolverService.cs
parentConsistently use EventId for event types (diff)
downloadLibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz
Apply syntax style to LibMatrix
Diffstat (limited to 'LibMatrix/Services/HomeserverResolverService.cs')
-rw-r--r--LibMatrix/Services/HomeserverResolverService.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/LibMatrix/Services/HomeserverResolverService.cs b/LibMatrix/Services/HomeserverResolverService.cs
index 9f937c5..a4a18e5 100644
--- a/LibMatrix/Services/HomeserverResolverService.cs
+++ b/LibMatrix/Services/HomeserverResolverService.cs
@@ -16,7 +16,7 @@ public class HomeserverResolverService(ILogger<HomeserverResolverService>? logge
 
     public async Task<WellKnownUris> ResolveHomeserverFromWellKnown(string homeserver) {
         if (homeserver is null) throw new ArgumentNullException(nameof(homeserver));
-        WellKnownSemaphores.TryAdd(homeserver, new(1, 1));
+        WellKnownSemaphores.TryAdd(homeserver, new SemaphoreSlim(1, 1));
         await WellKnownSemaphores[homeserver].WaitAsync();
         if (WellKnownCache.TryGetValue(homeserver, out var known)) {
             WellKnownSemaphores[homeserver].Release();
@@ -53,7 +53,7 @@ public class HomeserverResolverService(ILogger<HomeserverResolverService>? logge
         try {
             var resp = await _httpClient.GetFromJsonAsync<JsonElement>($"{homeserver}/.well-known/matrix/server");
             var hs = resp.GetProperty("m.server").GetString();
-            if(hs is null) throw new InvalidDataException("m.server is null");
+            if (hs is null) throw new InvalidDataException("m.server is null");
             if (!hs.StartsWithAnyOf("http://", "https://"))
                 hs = $"https://{hs}";
             return hs;
@@ -83,4 +83,4 @@ public class HomeserverResolverService(ILogger<HomeserverResolverService>? logge
         public string? Client { get; set; }
         public string? Server { get; set; }
     }
-}
+}
\ No newline at end of file