diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 978eee505c..dd131ee2e6 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -448,7 +448,7 @@ namespace osu.Game.Online.Multiplayer async Task IMultiplayerClient.Invited(int invitedBy, long roomID, string password) { APIUser? apiUser = await userLookupCache.GetUserAsync(invitedBy); - Room? apiRoom = await lookupRoom(roomID); + Room? apiRoom = await getRoomAsync(roomID); if (apiUser == null || apiRoom == null) return; @@ -462,23 +462,19 @@ namespace osu.Game.Online.Multiplayer } } ); - } - private Task lookupRoom(long id) - { - return Task.Run(() => + Task getRoomAsync(long id) { - var t = new TaskCompletionSource(); + TaskCompletionSource taskCompletionSource = new TaskCompletionSource(); + var request = new GetRoomRequest(id); - - request.Success += room => t.TrySetResult(room); - - request.Failure += e => t.TrySetResult(null); + request.Success += room => taskCompletionSource.TrySetResult(room); + request.Failure += _ => taskCompletionSource.TrySetResult(null); API.Queue(request); - return t.Task; - }); + return taskCompletionSource.Task; + } } private void addUserToAPIRoom(MultiplayerRoomUser user)