mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Try to address #3362
This commit is contained in:
@@ -187,6 +187,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToConstant_002ELocal/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToExpressionBodyWhenPossible/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLambdaExpressionWhenPossible/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DuplicatedSwitchSectionBodies/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DuplicateResource/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
|
||||
|
||||
@@ -2101,6 +2101,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
||||
}
|
||||
|
||||
private void DisposeShared() {
|
||||
ArchiHandler.Dispose();
|
||||
ArchiWebHandler.Dispose();
|
||||
BotDatabase.Dispose();
|
||||
ConnectionSemaphore.Dispose();
|
||||
|
||||
@@ -25,6 +25,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ArchiSteamFarm.Core;
|
||||
using ArchiSteamFarm.Localization;
|
||||
@@ -49,11 +50,11 @@ using EPersonaStateFlag = SteamKit2.EPersonaStateFlag;
|
||||
|
||||
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 SemaphoreSlim InventorySemaphore = new(1, 1);
|
||||
private readonly AccountPrivateApps UnifiedAccountPrivateApps;
|
||||
private readonly ChatRoom UnifiedChatRoomService;
|
||||
private readonly ClanChatRooms UnifiedClanChatRoomsService;
|
||||
@@ -87,6 +88,8 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
||||
UnifiedTwoFactorService = steamUnifiedMessages.CreateService<TwoFactor>();
|
||||
}
|
||||
|
||||
public void Dispose() => InventorySemaphore.Dispose();
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<bool> AddFriend(ulong steamID) {
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||
@@ -208,6 +211,9 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
||||
|
||||
Dictionary<(ulong ClassID, ulong InstanceID), InventoryDescription>? descriptions = null;
|
||||
|
||||
await InventorySemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
SteamUnifiedMessages.ServiceMethodResponse<CEcon_GetInventoryItemsWithDescriptions_Response>? response = null;
|
||||
|
||||
@@ -314,6 +320,9 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
||||
|
||||
request.start_assetid = response.Body.last_assetid;
|
||||
}
|
||||
} finally {
|
||||
InventorySemaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
|
||||
Reference in New Issue
Block a user