diff options
author | Rory& <root@rory.gay> | 2024-04-19 15:54:30 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-04-19 15:54:30 +0200 |
commit | 440807e02393410327cd86d5ffa007dee98f8954 (patch) | |
tree | e750b0bab55a9ee7b507cd48eaa4ccb2ddd25fc0 /LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | |
parent | Fix homeserver resolution, rewrite homeserver initialisation, HSE work (diff) | |
download | LibMatrix-440807e02393410327cd86d5ffa007dee98f8954.tar.xz |
Partial User-Interactive Authentication, allow skipping homeserver typing
Diffstat (limited to '')
-rw-r--r-- | LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index afa6a6c..267b54d 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -128,10 +128,20 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { public virtual async IAsyncEnumerable<GenericRoom> GetJoinedRoomsByType(string type) { var rooms = await GetJoinedRooms(); var tasks = rooms.Select(async room => { - var roomType = await room.GetRoomType(); - if (roomType == type) return room; - - return null; + while (true) { + try { + var roomType = await room.GetRoomType(); + if (roomType == type) return room; + return null; + } + catch (MatrixException e) { + throw; + } + catch (Exception e) { + Console.WriteLine($"Failed to get room type for {room.RoomId}: {e.Message}"); + await Task.Delay(1000); + } + } }).ToAsyncEnumerable(); await foreach (var result in tasks) |