about summary refs log tree commit diff
path: root/LibMatrix/Services/HomeserverProviderService.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:46:11 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:46:11 +0200
commitcb8846a7a3310f8513989da5aadb5202f048a1b3 (patch)
treecfbcf2506947d0f820208dd4cdb7a56c660ef0f9 /LibMatrix/Services/HomeserverProviderService.cs
parentUpdate dependencies (diff)
downloadLibMatrix-cb8846a7a3310f8513989da5aadb5202f048a1b3.tar.xz
Code cleanup
Diffstat (limited to 'LibMatrix/Services/HomeserverProviderService.cs')
-rw-r--r--LibMatrix/Services/HomeserverProviderService.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs
index 61c449a..366f0ca 100644
--- a/LibMatrix/Services/HomeserverProviderService.cs
+++ b/LibMatrix/Services/HomeserverProviderService.cs
@@ -14,12 +14,11 @@ public class HomeserverProviderService {
 
     public HomeserverProviderService(TieredStorageService tieredStorageService,
         ILogger<HomeserverProviderService> logger, HomeserverResolverService homeserverResolverService) {
-        Console.WriteLine("Homeserver provider service instantiated!");
         _tieredStorageService = tieredStorageService;
         _logger = logger;
         _homeserverResolverService = homeserverResolverService;
-        logger.LogDebug(
-            $"New HomeserverProviderService created with TieredStorageService<{string.Join(", ", tieredStorageService.GetType().GetProperties().Select(x => x.Name))}>!");
+        logger.LogDebug("New HomeserverProviderService created with TieredStorageService<{}>!",
+            string.Join(", ", tieredStorageService.GetType().GetProperties().Select(x => x.Name)));
     }
 
     private static Dictionary<string, SemaphoreSlim> _authenticatedHomeserverSemaphore = new();
@@ -27,7 +26,7 @@ public class HomeserverProviderService {
 
     public async Task<AuthenticatedHomeServer> GetAuthenticatedWithToken(string homeserver, string accessToken,
         string? overrideFullDomain = null) {
-        SemaphoreSlim sem = _authenticatedHomeserverSemaphore.GetOrCreate(homeserver+accessToken, _ => new SemaphoreSlim(1, 1));
+        var sem = _authenticatedHomeserverSemaphore.GetOrCreate(homeserver+accessToken, _ => new SemaphoreSlim(1, 1));
         await sem.WaitAsync();
         if (_authenticatedHomeServerCache.ContainsKey(homeserver+accessToken)) {
             sem.Release();
@@ -64,7 +63,7 @@ public class HomeserverProviderService {
         string? overrideFullDomain = null) {
         var hs = await GetRemoteHomeserver(homeserver, overrideFullDomain);
         var payload = new LoginRequest {
-            Identifier = new() { User = user },
+            Identifier = new LoginRequest.LoginIdentifier { User = user },
             Password = password
         };
         var resp = await hs._httpClient.PostAsJsonAsync("/_matrix/client/v3/login", payload);