From c22eb5872ebcd1a284e354b645d4dc634412513b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Mon, 14 Oct 2024 20:07:23 +0200 Subject: [PATCH] Make it work --- ArchiSteamFarm/Steam/Bot.cs | 1 + .../Steam/Integration/ArchiHandler.cs | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 4598bad741b07..257a558a94872 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2098,6 +2098,7 @@ private void Disconnect(bool reconnect = false) { } private void DisposeShared() { + ArchiHandler.Dispose(); ArchiWebHandler.Dispose(); BotDatabase.Dispose(); ConnectionSemaphore.Dispose(); diff --git a/ArchiSteamFarm/Steam/Integration/ArchiHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiHandler.cs index de50f36f8f0f6..3daf433f120e0 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiHandler.cs @@ -49,11 +49,14 @@ namespace ArchiSteamFarm.Steam.Integration; -public sealed class ArchiHandler : ClientMsgHandler { +public sealed class ArchiHandler : ClientMsgHandler, IDisposable { internal const byte MaxGamesPlayedConcurrently = 32; // This is limit introduced by Steam Network private readonly ArchiLogger ArchiLogger; + private readonly ChatRoomClient ChatRoomClient; + private readonly FriendMessagesClient FriendMessagesClient; + private readonly AccountPrivateApps UnifiedAccountPrivateApps; private readonly ChatRoom UnifiedChatRoomService; private readonly ClanChatRooms UnifiedClanChatRoomsService; @@ -85,6 +88,25 @@ internal ArchiHandler(ArchiLogger archiLogger, SteamUnifiedMessages steamUnified UnifiedPlayerService = steamUnifiedMessages.CreateService(); UnifiedStoreService = steamUnifiedMessages.CreateService(); UnifiedTwoFactorService = steamUnifiedMessages.CreateService(); + + ChatRoomClient = steamUnifiedMessages.CreateService(); + FriendMessagesClient = steamUnifiedMessages.CreateService(); + } + + public void Dispose() { + ChatRoomClient.Dispose(); + FriendMessagesClient.Dispose(); + UnifiedAccountPrivateApps.Dispose(); + UnifiedChatRoomService.Dispose(); + UnifiedClanChatRoomsService.Dispose(); + UnifiedCredentialsService.Dispose(); + UnifiedEconService.Dispose(); + UnifiedFamilyGroups.Dispose(); + UnifiedFriendMessagesService.Dispose(); + UnifiedLoyaltyRewards.Dispose(); + UnifiedPlayerService.Dispose(); + UnifiedStoreService.Dispose(); + UnifiedTwoFactorService.Dispose(); } [PublicAPI]