From 292ae029f93b7a46ee53096767aad586da8128a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=99=E7=A9=8F=E9=9D=84?= <170472707+seionmoya@users.noreply.github.com> Date: Fri, 15 Nov 2024 05:33:07 +0100 Subject: [PATCH] Avoid cration of new async contexts --- .../Controllers/AccountGamesController.cs | 4 +-- .../Controllers/AccountLogoutController.cs | 4 +-- .../Http/AccountCustomizationController.cs | 4 +-- .../Http/AchievementListController.cs | 4 +-- .../Http/AchievementStatisticController.cs | 4 +-- .../Controllers/Http/BuildsListController.cs | 4 +-- .../Http/CheckVersionController.cs | 4 +-- .../Http/CustomizationController.cs | 4 +-- .../Http/CustomizationStorageController.cs | 4 +-- .../Controllers/Http/FriendListController.cs | 4 +-- .../Http/FriendRequestListInboxController.cs | 4 +-- .../Http/FriendRequestListOutboxController.cs | 4 +-- .../Controllers/Http/GameConfigController.cs | 4 +-- .../Http/GameKeepaliveController.cs | 4 +-- .../Controllers/Http/GameLogoutController.cs | 4 +-- .../Http/GameProfileListController.cs | 4 +-- .../GameProfileNicknameReservedController.cs | 4 +-- .../Http/GameProfileSelectController.cs | 4 +-- .../Controllers/Http/GameStartController.cs | 4 +-- .../Http/GameVersionValidateController.cs | 4 +-- .../Http/GetMetricsConfigController.cs | 4 +-- .../Controllers/Http/GlobalsController.cs | 4 +-- .../Http/HandbookTemplatesController.cs | 4 +-- .../Http/HideoutAreasController.cs | 4 +-- .../HideoutProductionRecipesController.cs | 4 +-- .../Http/HideoutQteListController.cs | 4 +-- .../Http/HideoutSettingsController.cs | 4 +-- .../Controllers/Http/ItemsController.cs | 4 +-- .../Controllers/Http/LanguagesController.cs | 4 +-- .../Http/LocalGameWeatherController.cs | 4 +-- .../Controllers/Http/LocationsController.cs | 4 +-- .../Http/MailDialogListController.cs | 4 +-- .../Http/MatchGroupCurrentController.cs | 4 +-- .../Http/MatchGroupExitFromMenuController.cs | 4 +-- .../MatchGroupInviteCancelAllController.cs | 4 +-- .../Http/MatchLocalEndController.cs | 4 +-- .../Controllers/Http/MenuLocaleController.cs | 4 +-- .../Http/NotifierChannelCreateController.cs | 4 +-- .../Http/ProfileSettingsController.cs | 4 +-- .../Http/ProfileStatusController.cs | 4 +-- .../Controllers/Http/PutMetricsController.cs | 4 +-- .../Controllers/Http/QuestListController.cs | 4 +-- .../Http/RaidConfigurationController.cs | 4 +-- ...epeatableQuestActivityPeriodsController.cs | 4 +-- .../Controllers/Http/ServerListController.cs | 4 +-- .../Controllers/Http/SettingsController.cs | 4 +-- .../Controllers/Http/SurveyController.cs | 4 +-- .../Http/TraderSettingsController.cs | 4 +-- .../Controllers/Http/WeatherController.cs | 4 +-- Fuyu.Common/Networking/HttpClient.cs | 16 ++++++------ Fuyu.Common/Networking/HttpContext.cs | 26 ++++++++++--------- Fuyu.Common/Networking/HttpController.cs | 6 ++--- Fuyu.Common/Networking/WsContext.cs | 10 +++---- 53 files changed, 127 insertions(+), 127 deletions(-) diff --git a/Fuyu.Backend.Core/Controllers/AccountGamesController.cs b/Fuyu.Backend.Core/Controllers/AccountGamesController.cs index 0df4ecae..dd6ac723 100644 --- a/Fuyu.Backend.Core/Controllers/AccountGamesController.cs +++ b/Fuyu.Backend.Core/Controllers/AccountGamesController.cs @@ -12,7 +12,7 @@ public AccountGamesController() : base("/account/games") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); var result = AccountService.GetGames(sessionId); @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) Games = result }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } diff --git a/Fuyu.Backend.Core/Controllers/AccountLogoutController.cs b/Fuyu.Backend.Core/Controllers/AccountLogoutController.cs index dd41e156..a5df1447 100644 --- a/Fuyu.Backend.Core/Controllers/AccountLogoutController.cs +++ b/Fuyu.Backend.Core/Controllers/AccountLogoutController.cs @@ -9,12 +9,12 @@ public AccountLogoutController() : base("/account/logout") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); CoreOrm.RemoveSession(sessionId); - await context.SendJsonAsync("{}"); + return context.SendJsonAsync("{}"); } } } diff --git a/Fuyu.Backend.EFT/Controllers/Http/AccountCustomizationController.cs b/Fuyu.Backend.EFT/Controllers/Http/AccountCustomizationController.cs index 7fd7117b..6392c1ea 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/AccountCustomizationController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/AccountCustomizationController.cs @@ -9,9 +9,9 @@ public AccountCustomizationController() : base("/client/account/customization") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetAccountCustomization()); + return context.SendJsonAsync(EftOrm.GetAccountCustomization()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/AchievementListController.cs b/Fuyu.Backend.EFT/Controllers/Http/AchievementListController.cs index 24f74f73..4eba5c9c 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/AchievementListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/AchievementListController.cs @@ -9,9 +9,9 @@ public AchievementListController() : base("/client/achievement/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetAchievementList()); + return context.SendJsonAsync(EftOrm.GetAchievementList()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/AchievementStatisticController.cs b/Fuyu.Backend.EFT/Controllers/Http/AchievementStatisticController.cs index c0e69be6..ef0bcd5f 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/AchievementStatisticController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/AchievementStatisticController.cs @@ -11,11 +11,11 @@ public AchievementStatisticController() : base("/client/achievement/statistic") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var json = EftOrm.GetAchievementStatistic(); var response = Json.Parse>(json); - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/BuildsListController.cs b/Fuyu.Backend.EFT/Controllers/Http/BuildsListController.cs index 486804e0..df129fec 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/BuildsListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/BuildsListController.cs @@ -16,9 +16,9 @@ public BuildsListController() : base("/client/builds/list") _response = Json.Parse>(json); } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(Json.Stringify(_response)); + return context.SendJsonAsync(Json.Stringify(_response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/CheckVersionController.cs b/Fuyu.Backend.EFT/Controllers/Http/CheckVersionController.cs index f2aaae9a..46bf5b8b 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/CheckVersionController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/CheckVersionController.cs @@ -11,7 +11,7 @@ public CheckVersionController() : base("/client/checkVersion") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -22,7 +22,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/CustomizationController.cs b/Fuyu.Backend.EFT/Controllers/Http/CustomizationController.cs index 225e01cf..08016d12 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/CustomizationController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/CustomizationController.cs @@ -13,7 +13,7 @@ public CustomizationController() : base("/client/customization") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var customizations = EftOrm.GetCustomizations(); var response = new ResponseBody>() @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) data = customizations }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/CustomizationStorageController.cs b/Fuyu.Backend.EFT/Controllers/Http/CustomizationStorageController.cs index 193e09f5..df4dccae 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/CustomizationStorageController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/CustomizationStorageController.cs @@ -11,7 +11,7 @@ public CustomizationStorageController() : base("/client/trading/customization/st { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); var profile = EftOrm.GetActiveProfile(sessionId); @@ -25,7 +25,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/FriendListController.cs b/Fuyu.Backend.EFT/Controllers/Http/FriendListController.cs index e54553bd..6ccfefa6 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/FriendListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/FriendListController.cs @@ -11,7 +11,7 @@ public FriendListController() : base("/client/friend/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -23,7 +23,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListInboxController.cs b/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListInboxController.cs index 4ad41919..2398384a 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListInboxController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListInboxController.cs @@ -11,14 +11,14 @@ public FriendRequestListInboxController() : base("/client/friend/request/list/in { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = [] }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListOutboxController.cs b/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListOutboxController.cs index ec356b04..5bba9c73 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListOutboxController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/FriendRequestListOutboxController.cs @@ -11,14 +11,14 @@ public FriendRequestListOutboxController() : base("/client/friend/request/list/o { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = [] }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameConfigController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameConfigController.cs index 18364507..0fdead99 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameConfigController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameConfigController.cs @@ -12,7 +12,7 @@ public GameConfigController() : base("/client/game/config") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody { @@ -37,7 +37,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameKeepaliveController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameKeepaliveController.cs index 94683cd0..a5b97926 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameKeepaliveController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameKeepaliveController.cs @@ -11,7 +11,7 @@ public GameKeepaliveController() : base("/client/game/keepalive") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody { @@ -22,7 +22,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameLogoutController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameLogoutController.cs index 0ff1bb37..a45a3a4c 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameLogoutController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameLogoutController.cs @@ -11,7 +11,7 @@ public GameLogoutController() : base("/client/game/logout") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameProfileListController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameProfileListController.cs index 43df3d0f..5d6d6118 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameProfileListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameProfileListController.cs @@ -12,7 +12,7 @@ public GameProfileListController() : base("/client/game/profile/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); var profile = EftOrm.GetActiveProfile(sessionId); @@ -32,7 +32,7 @@ public override async Task RunAsync(HttpContext context) data = profiles }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameProfileNicknameReservedController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameProfileNicknameReservedController.cs index 01b678ca..ddb03069 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameProfileNicknameReservedController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameProfileNicknameReservedController.cs @@ -11,7 +11,7 @@ public GameProfileNicknameReservedController() : base("/client/game/profile/nick { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); var account = EftOrm.GetAccount(sessionId); @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) data = account.Username }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameProfileSelectController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameProfileSelectController.cs index 3ab2b077..e6a89cc3 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameProfileSelectController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameProfileSelectController.cs @@ -11,7 +11,7 @@ public GameProfileSelectController() : base("/client/game/profile/select") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameStartController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameStartController.cs index f5d5cf2a..004ac89e 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameStartController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameStartController.cs @@ -11,7 +11,7 @@ public GameStartController() : base("/client/game/start") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -21,7 +21,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GameVersionValidateController.cs b/Fuyu.Backend.EFT/Controllers/Http/GameVersionValidateController.cs index 471bd826..31d387c5 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GameVersionValidateController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GameVersionValidateController.cs @@ -11,14 +11,14 @@ public GameVersionValidateController() : base("/client/game/version/validate") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GetMetricsConfigController.cs b/Fuyu.Backend.EFT/Controllers/Http/GetMetricsConfigController.cs index 851968f1..d8ed486d 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GetMetricsConfigController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GetMetricsConfigController.cs @@ -11,7 +11,7 @@ public GetMetricsConfigController() : base("/client/getMetricsConfig") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -26,7 +26,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/GlobalsController.cs b/Fuyu.Backend.EFT/Controllers/Http/GlobalsController.cs index cb824d61..096bc475 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/GlobalsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/GlobalsController.cs @@ -9,9 +9,9 @@ public GlobalsController() : base("/client/globals") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetGlobals()); + return context.SendJsonAsync(EftOrm.GetGlobals()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/HandbookTemplatesController.cs b/Fuyu.Backend.EFT/Controllers/Http/HandbookTemplatesController.cs index 7f72a326..b144f4d9 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/HandbookTemplatesController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/HandbookTemplatesController.cs @@ -9,9 +9,9 @@ public HandbookTemplatesController() : base("/client/handbook/templates") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetHandbook()); + return context.SendJsonAsync(EftOrm.GetHandbook()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/HideoutAreasController.cs b/Fuyu.Backend.EFT/Controllers/Http/HideoutAreasController.cs index 367f149f..77abba06 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/HideoutAreasController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/HideoutAreasController.cs @@ -9,9 +9,9 @@ public HideoutAreasController() : base("/client/hideout/areas") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetHideoutAreas()); + return context.SendJsonAsync(EftOrm.GetHideoutAreas()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/HideoutProductionRecipesController.cs b/Fuyu.Backend.EFT/Controllers/Http/HideoutProductionRecipesController.cs index dd71b24b..dea8f8f0 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/HideoutProductionRecipesController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/HideoutProductionRecipesController.cs @@ -9,9 +9,9 @@ public HideoutProductionRecipesController() : base("/client/hideout/production/r { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetHideoutProductionRecipes()); + return context.SendJsonAsync(EftOrm.GetHideoutProductionRecipes()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/HideoutQteListController.cs b/Fuyu.Backend.EFT/Controllers/Http/HideoutQteListController.cs index be88913d..651b8cf5 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/HideoutQteListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/HideoutQteListController.cs @@ -9,9 +9,9 @@ public HideoutQteListController() : base("/client/hideout/qte/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetHideoutQteList()); + return context.SendJsonAsync(EftOrm.GetHideoutQteList()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/HideoutSettingsController.cs b/Fuyu.Backend.EFT/Controllers/Http/HideoutSettingsController.cs index 3538a8e2..c1dab6a3 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/HideoutSettingsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/HideoutSettingsController.cs @@ -11,11 +11,11 @@ public HideoutSettingsController() : base("/client/hideout/settings") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var json = EftOrm.GetHideoutSettings(); var response = Json.Parse>(json); - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/ItemsController.cs b/Fuyu.Backend.EFT/Controllers/Http/ItemsController.cs index adada58e..5bee6759 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/ItemsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/ItemsController.cs @@ -9,9 +9,9 @@ public ItemsController() : base("/client/items") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetItems()); + return context.SendJsonAsync(EftOrm.GetItems()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/LanguagesController.cs b/Fuyu.Backend.EFT/Controllers/Http/LanguagesController.cs index d1a1f0fc..8c51c90d 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/LanguagesController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/LanguagesController.cs @@ -12,7 +12,7 @@ public LanguagesController() : base("/client/languages") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var languages = EftOrm.GetLanguages(); var response = new ResponseBody> @@ -20,7 +20,7 @@ public override async Task RunAsync(HttpContext context) data = languages }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/LocalGameWeatherController.cs b/Fuyu.Backend.EFT/Controllers/Http/LocalGameWeatherController.cs index 1d01130d..11308643 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/LocalGameWeatherController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/LocalGameWeatherController.cs @@ -9,9 +9,9 @@ public LocalGameWeatherController() : base("/client/localGame/weather") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetLocalWeather()); + return context.SendJsonAsync(EftOrm.GetLocalWeather()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/LocationsController.cs b/Fuyu.Backend.EFT/Controllers/Http/LocationsController.cs index e94a97f6..fe622fd4 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/LocationsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/LocationsController.cs @@ -12,12 +12,12 @@ public LocationsController() : base("/client/locations") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var json = EftOrm.GetLocations(); var locations = Json.Parse>(json); var response = Json.Stringify(locations); - await context.SendJsonAsync(response); + return context.SendJsonAsync(response); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MailDialogListController.cs b/Fuyu.Backend.EFT/Controllers/Http/MailDialogListController.cs index 7e457f16..3a7035fb 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MailDialogListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MailDialogListController.cs @@ -11,14 +11,14 @@ public MailDialogListController() : base("/client/mail/dialog/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody { data = [] }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupCurrentController.cs b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupCurrentController.cs index a773a5ca..1ab334d3 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupCurrentController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupCurrentController.cs @@ -11,7 +11,7 @@ public MatchGroupCurrentController() : base("/client/match/group/current") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -22,7 +22,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupExitFromMenuController.cs b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupExitFromMenuController.cs index 99bada20..932b0491 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupExitFromMenuController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupExitFromMenuController.cs @@ -11,14 +11,14 @@ public MatchGroupExitFromMenuController() : base("/client/match/group/exit_from_ { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupInviteCancelAllController.cs b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupInviteCancelAllController.cs index e4465c66..da035d88 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MatchGroupInviteCancelAllController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MatchGroupInviteCancelAllController.cs @@ -11,14 +11,14 @@ public MatchGroupInviteCancelAllController() : base("/client/match/group/invite/ { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = true }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MatchLocalEndController.cs b/Fuyu.Backend.EFT/Controllers/Http/MatchLocalEndController.cs index ac5c6f0e..1a547620 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MatchLocalEndController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MatchLocalEndController.cs @@ -13,7 +13,7 @@ public MatchLocalEndController() : base("/client/match/local/end") { } - public override async Task RunAsync(HttpContext context, MatchLocalEndRequest body) + public override Task RunAsync(HttpContext context, MatchLocalEndRequest body) { var sessionId = context.GetSessionId(); @@ -47,7 +47,7 @@ public override async Task RunAsync(HttpContext context, MatchLocalEndRequest bo data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/MenuLocaleController.cs b/Fuyu.Backend.EFT/Controllers/Http/MenuLocaleController.cs index d5fa2286..40358baa 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/MenuLocaleController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/MenuLocaleController.cs @@ -15,7 +15,7 @@ public MenuLocaleController() : base(PathExpression()) { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var parameters = context.GetPathParameters(this); @@ -26,7 +26,7 @@ public override async Task RunAsync(HttpContext context) data = locale }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } diff --git a/Fuyu.Backend.EFT/Controllers/Http/NotifierChannelCreateController.cs b/Fuyu.Backend.EFT/Controllers/Http/NotifierChannelCreateController.cs index f127d935..a2d54680 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/NotifierChannelCreateController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/NotifierChannelCreateController.cs @@ -12,7 +12,7 @@ public NotifierChannelCreateController() : base("/client/notifier/channel/create { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var channelId = SimpleId.Generate(64); var response = new ResponseBody @@ -26,7 +26,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/ProfileSettingsController.cs b/Fuyu.Backend.EFT/Controllers/Http/ProfileSettingsController.cs index 015127a8..0f9de2e6 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/ProfileSettingsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/ProfileSettingsController.cs @@ -11,14 +11,14 @@ public ProfileSettingsController() : base("/client/profile/settings") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = true }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/ProfileStatusController.cs b/Fuyu.Backend.EFT/Controllers/Http/ProfileStatusController.cs index 0d1d0702..75145f8c 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/ProfileStatusController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/ProfileStatusController.cs @@ -12,7 +12,7 @@ public ProfileStatusController() : base("/client/profile/status") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var sessionId = context.GetSessionId(); @@ -47,7 +47,7 @@ public override async Task RunAsync(HttpContext context) } }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/PutMetricsController.cs b/Fuyu.Backend.EFT/Controllers/Http/PutMetricsController.cs index 7c3b4766..afd8b1eb 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/PutMetricsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/PutMetricsController.cs @@ -11,14 +11,14 @@ public PutMetricsController() : base("/client/putMetrics") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/QuestListController.cs b/Fuyu.Backend.EFT/Controllers/Http/QuestListController.cs index d543c2de..fcf1c540 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/QuestListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/QuestListController.cs @@ -9,9 +9,9 @@ public QuestListController() : base("/client/quest/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetQuest()); + return context.SendJsonAsync(EftOrm.GetQuest()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/RaidConfigurationController.cs b/Fuyu.Backend.EFT/Controllers/Http/RaidConfigurationController.cs index 65271e03..2d2612da 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/RaidConfigurationController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/RaidConfigurationController.cs @@ -11,14 +11,14 @@ public RaidConfigurationController() : base("/client/raid/configuration") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/RepeatableQuestActivityPeriodsController.cs b/Fuyu.Backend.EFT/Controllers/Http/RepeatableQuestActivityPeriodsController.cs index ac260bfc..19c6ada9 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/RepeatableQuestActivityPeriodsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/RepeatableQuestActivityPeriodsController.cs @@ -11,14 +11,14 @@ public RepeatableQuestActivityPeriodsController() : base("/client/repeatalbeQues { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody { data = [] }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/ServerListController.cs b/Fuyu.Backend.EFT/Controllers/Http/ServerListController.cs index fdf154be..bfa903e3 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/ServerListController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/ServerListController.cs @@ -12,7 +12,7 @@ public ServerListController() : base("/client/server/list") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { @@ -25,7 +25,7 @@ public override async Task RunAsync(HttpContext context) ] }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/SettingsController.cs b/Fuyu.Backend.EFT/Controllers/Http/SettingsController.cs index 471ee882..4621286c 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/SettingsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/SettingsController.cs @@ -9,9 +9,9 @@ public SettingsController() : base("/client/settings") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetSettings()); + return context.SendJsonAsync(EftOrm.GetSettings()); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/SurveyController.cs b/Fuyu.Backend.EFT/Controllers/Http/SurveyController.cs index 6ded97f3..13167309 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/SurveyController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/SurveyController.cs @@ -11,14 +11,14 @@ public SurveyController() : base("/client/survey") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody() { data = null }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/TraderSettingsController.cs b/Fuyu.Backend.EFT/Controllers/Http/TraderSettingsController.cs index e8213cae..4dc04fc1 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/TraderSettingsController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/TraderSettingsController.cs @@ -13,14 +13,14 @@ public TraderSettingsController() : base("/client/trading/api/traderSettings") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { var response = new ResponseBody> { data = TraderDatabase.GetTraderTemplates().Values }; - await context.SendJsonAsync(Json.Stringify(response)); + return context.SendJsonAsync(Json.Stringify(response)); } } } \ No newline at end of file diff --git a/Fuyu.Backend.EFT/Controllers/Http/WeatherController.cs b/Fuyu.Backend.EFT/Controllers/Http/WeatherController.cs index 48e6dc0e..6a4d20bb 100644 --- a/Fuyu.Backend.EFT/Controllers/Http/WeatherController.cs +++ b/Fuyu.Backend.EFT/Controllers/Http/WeatherController.cs @@ -9,9 +9,9 @@ public WeatherController() : base("/client/weather") { } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { - await context.SendJsonAsync(EftOrm.GetWeather()); + return context.SendJsonAsync(EftOrm.GetWeather()); } } } \ No newline at end of file diff --git a/Fuyu.Common/Networking/HttpClient.cs b/Fuyu.Common/Networking/HttpClient.cs index f5879343..4891e86d 100644 --- a/Fuyu.Common/Networking/HttpClient.cs +++ b/Fuyu.Common/Networking/HttpClient.cs @@ -91,7 +91,7 @@ protected async Task SendAsync(HttpMethod method, string path, byt }; } - protected async Task SendWithRetriesAsync(HttpMethod method, string path, byte[] data) + protected Task SendWithRetriesAsync(HttpMethod method, string path, byte[] data) { var error = new Exception("Internal error"); @@ -100,7 +100,7 @@ protected async Task SendWithRetriesAsync(HttpMethod method, strin { try { - return await SendAsync(method, path, data); + return SendAsync(method, path, data); } catch (Exception ex) { @@ -111,9 +111,9 @@ protected async Task SendWithRetriesAsync(HttpMethod method, strin throw error; } - public async Task GetAsync(string path) + public Task GetAsync(string path) { - return await SendWithRetriesAsync(HttpMethod.Get, path, null); + return SendWithRetriesAsync(HttpMethod.Get, path, null); } public HttpResponse Get(string path) @@ -123,9 +123,9 @@ public HttpResponse Get(string path) .GetResult(); } - public async Task PostAsync(string path, byte[] data) + public Task PostAsync(string path, byte[] data) { - return await SendWithRetriesAsync(HttpMethod.Post, path, data); + return SendWithRetriesAsync(HttpMethod.Post, path, data); } public HttpResponse Post(string path, byte[] data) @@ -135,9 +135,9 @@ public HttpResponse Post(string path, byte[] data) .GetResult(); } - public async Task PutAsync(string path, byte[] data) + public Task PutAsync(string path, byte[] data) { - return await SendWithRetriesAsync(HttpMethod.Put, path, data); + return SendWithRetriesAsync(HttpMethod.Put, path, data); } public HttpResponse Put(string path, byte[] data) diff --git a/Fuyu.Common/Networking/HttpContext.cs b/Fuyu.Common/Networking/HttpContext.cs index f4b6a9e9..4c2a0f73 100644 --- a/Fuyu.Common/Networking/HttpContext.cs +++ b/Fuyu.Common/Networking/HttpContext.cs @@ -19,11 +19,12 @@ public bool HasBody() return Request.HasEntityBody; } - public async Task GetBinaryAsync() + public byte[] GetBinary() { using (var ms = new MemoryStream()) { - await Request.InputStream.CopyToAsync(ms); + Request.InputStream.CopyTo(ms); + var body = ms.ToArray(); if (MemoryZlib.IsCompressed(body)) @@ -35,15 +36,15 @@ public async Task GetBinaryAsync() } } - public async Task GetTextAsync() + public string GetText() { - var body = await GetBinaryAsync(); + var body = GetBinary(); return Encoding.UTF8.GetString(body); } - public async Task GetJsonAsync() + public T GetJson() { - var json = await GetTextAsync(); + var json = GetText(); return Json.Parse(json); } @@ -57,7 +58,7 @@ public string GetSessionId() return Request.Cookies["PHPSESSID"].Value; } - protected async Task SendAsync(byte[] data, string mime, HttpStatusCode status, bool zipped = true) + protected Task SendAsync(byte[] data, string mime, HttpStatusCode status, bool zipped = true) { bool hasData = !(data is null); @@ -90,18 +91,19 @@ protected async Task SendAsync(byte[] data, string mime, HttpStatusCode status, { using (var payload = Response.OutputStream) { - await payload.WriteAsync(data, 0, data.Length); + return payload.WriteAsync(data, 0, data.Length); } } else { Response.Close(); + return Task.CompletedTask; } } - public async Task SendStatus(HttpStatusCode status) + public Task SendStatus(HttpStatusCode status) { - await SendAsync(null, "plain/text", status, false); + return SendAsync(null, "plain/text", status, false); } public Task SendBinaryAsync(byte[] data, string mime, bool zipped = true) @@ -109,14 +111,14 @@ public Task SendBinaryAsync(byte[] data, string mime, bool zipped = true) return SendAsync(data, mime, HttpStatusCode.OK, zipped); } - public async Task SendJsonAsync(string text, bool zipped = true) + public Task SendJsonAsync(string text, bool zipped = true) { var encoded = Encoding.UTF8.GetBytes(text); var mime = zipped ? "application/octet-stream" : "application/json; charset=utf-8"; - await SendAsync(encoded, mime, HttpStatusCode.OK, zipped); + return SendAsync(encoded, mime, HttpStatusCode.OK, zipped); } public void Close() diff --git a/Fuyu.Common/Networking/HttpController.cs b/Fuyu.Common/Networking/HttpController.cs index dc1448be..d40ad2eb 100644 --- a/Fuyu.Common/Networking/HttpController.cs +++ b/Fuyu.Common/Networking/HttpController.cs @@ -29,7 +29,7 @@ protected HttpController(string path) : base(path) // match static paths } - public override async Task RunAsync(HttpContext context) + public override Task RunAsync(HttpContext context) { // TODO: // - Use better exception type @@ -39,7 +39,7 @@ public override async Task RunAsync(HttpContext context) throw new Exception("Request does not contain body."); } - var body = await context.GetJsonAsync(); + var body = context.GetJson(); // TODO: // - Use better exception type @@ -49,7 +49,7 @@ public override async Task RunAsync(HttpContext context) throw new Exception("Body could not be parsed as TRequest."); } - await RunAsync(context, body); + return RunAsync(context, body); } public abstract Task RunAsync(HttpContext context, TRequest body); diff --git a/Fuyu.Common/Networking/WsContext.cs b/Fuyu.Common/Networking/WsContext.cs index 857e7f11..936d11dd 100644 --- a/Fuyu.Common/Networking/WsContext.cs +++ b/Fuyu.Common/Networking/WsContext.cs @@ -52,7 +52,6 @@ internal async Task PollAsync() { await OnTextEvent(this, text); } - break; case WebSocketMessageType.Binary: @@ -60,7 +59,6 @@ internal async Task PollAsync() { await OnBinaryEvent(this, data); } - break; case WebSocketMessageType.Close: @@ -69,17 +67,17 @@ internal async Task PollAsync() } } - public async Task SendTextAsync(string text) + public Task SendTextAsync(string text) { var encoded = Encoding.UTF8.GetBytes(text); var buffer = new ArraySegment(encoded, 0, encoded.Length); - await _ws.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None); + return _ws.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None); } - public async Task SendBinaryAsync(byte[] data) + public Task SendBinaryAsync(byte[] data) { var buffer = new ArraySegment(data, 0, data.Length); - await _ws.SendAsync(buffer, WebSocketMessageType.Binary, true, CancellationToken.None); + return _ws.SendAsync(buffer, WebSocketMessageType.Binary, true, CancellationToken.None); } public async Task CloseAsync()