Commit Graph

70 Commits

Author SHA1 Message Date
JustArchi
a8045ac50b Fix async/await with ConcurrentHashSet
Now this is a nice bug that was found accidentally by ArchiBoT...
ReaderWriterLockSlim() is very decent solution, but it's thread-based, and we're using our ConcurrentHashSet in mixed async/sync context. This means that if we use something like:
foreach (var item in concHashSet) {
    await AnythingAsync().ConfigureAwait(false);
}
It's totally possible that we'll request read lock as thread 1, and release the read lock as thread 2, which will lead to RWLock exception => System.Threading.SynchronizationLockException: The read lock is being released without being held.
Fortunately it looks like we didn't have any scenario like this in ASF, as this was possible only when we async/await while enumerating over ConcurrentHashSet, so that specific bug didn't affect ASF codebase (yet). Still, I must fix this as current implementation is not thread-safe, so our HashSet is in fact not concurrent in the first place.
I analyzed possible solutions and there are basically 3: either using ConcurrentDictionary and wrapping around it, replacing lock with SemaphoreSlim, or using third-party AsyncReaderWriterLock from StephenCleary. SemaphoreSlim entirely kills the concept of multiple readers one writer, and could affect performance negatively, moreover - it doesn't support upgreadable lock scenario we have with ReplaceIfNeededWith(). Concurrent dictionary would be nice if I didn't have that awful memory hit from storing mandatory pointless value, plus I don't really like concept of wrapping around conc dictionary if I can simply use it right away and drop my conc hashset entirely. AsyncReaderWriterLock seem to be really well written, and works on Mono + should be compatible with .NET core in the future, so we should go for it as it's the best bet both performance-wise and memory-wise.
This brings another package dependency and changes a bit backend of ConcurrentHashSet
2017-02-07 20:14:51 +01:00
JustArchi
b4483057b9 Fix build 2017-02-05 14:35:55 +01:00
JustArchi
f72c51a2f8 Misc 2017-02-05 14:35:27 +01:00
JustArchi
c887dc102e Unify ASF/GUI startup 2017-02-05 14:32:38 +01:00
JustArchi
2af76f746d Closes #457 2017-02-05 13:52:00 +01:00
JustArchi
bd9fde0799 Misc 2017-02-02 19:04:31 +01:00
JustArchi
3de44af605 Misc 2017-02-02 18:02:02 +01:00
JustArchi
d5e865dff3 Misc 2017-02-01 00:49:49 +01:00
JustArchi
fb4cda513b Don't wait for bot being stopped too long 2017-02-01 00:44:52 +01:00
JustArchi
372e71dcfd Closes #339
We should finally start using latest SK2 enhancements, some of which I added myself to official SK2 repo.
I hope this solves various network quirks that suddenly arrived either with Steam network, or ASF code changes regarding HeartBeats.
The .dll bin is self-compiled from latest SK2 repo, I hope I can drop it when SK2 arrives on nuget, but when it happens - not sure, while I want to test if this fixes particular issues that are happening lately.
2017-01-31 03:12:02 +01:00
JustArchi
fc4574d143 Closes #445
Review https://github.com/JustArchi/ArchiSteamFarm/wiki/Logging for examples once I'm done updating the wiki
2017-01-31 01:10:01 +01:00
JustArchi
b5e33ec38e Misc 2017-01-28 05:11:38 +01:00
JustArchi
d93a276926 Optimize unused references 2017-01-24 03:01:04 +01:00
JustArchi
8fa2795323 Packages update 2017-01-24 02:58:43 +01:00
JustArchi
79913e1e11 Misc 2017-01-21 18:28:33 +01:00
JustArchi
7b11c34d40 Link new translations 2017-01-21 18:28:02 +01:00
JustArchi
ac78a0ab39 Packages update 2017-01-19 16:38:28 +01:00
JustArchi
856c7d1f9d Revert "Link new translations"
This reverts commit da9323a46e.
2017-01-18 07:01:16 +01:00
JustArchi
da9323a46e Link new translations 2017-01-18 05:57:20 +01:00
JustArchi
03cc5e983b Link new translations 2017-01-16 01:28:44 +01:00
JustArchi
d0307c6161 Bring translations to ASF-GUI 2017-01-13 23:47:12 +01:00
JustArchi
c348686441 Don't embed on Linux 2017-01-07 02:42:37 +01:00
JustArchi
653b910d2e Start embedding localizations 2017-01-07 02:39:29 +01:00
JustArchi
b2f27d9aba Convert pl translation into crowdin format 2017-01-06 19:51:09 +01:00
JustArchi
c51061f0fb Start working on translations 2017-01-06 12:11:11 +01:00
JustArchi
ba8d70aebb Copyright update 2017-01-02 20:05:21 +01:00
JustArchi
19d15f09ff Optimize references 2016-12-26 23:15:01 +01:00
JustArchi
cf21c2a815 Remove dependency on Humanizer 2016-12-26 23:08:27 +01:00
JustArchi
8639275ed8 Fix 2016-12-26 22:41:50 +01:00
JustArchi
ba3461b58f Packages update 2016-12-26 22:10:56 +01:00
JustArchi
33edc81116 Add farming time approximation
Because @MaduRUDE asked nicely
2016-12-26 22:07:49 +01:00
JustArchi
9d882784ee Implement workaround for #380 2016-12-24 19:27:36 +01:00
JustArchi
30c69cf57c Move main ArchiLogger from ASF to Program
It makes more sense to put it in ASF class due to sharing potential, but I want to unify ArchiBoT logging and this makes it easier for maintenance
2016-12-23 18:49:52 +01:00
JustArchi
90d74de169 [EXPERIMENTAL] Queue discovery
Yes, you know my donation address
2016-12-23 03:01:37 +01:00
JustArchi
9d0cc07d4e Reject clan invites when IsBotAccount
Also make it possible for quite rare situation of ASF accepting invite to SteamMasterClanID if it couldn't join due to group being non-public
2016-12-11 04:23:44 +01:00
JustArchi
cb0d1c9484 Misc 2016-12-04 06:01:18 +01:00
JustArchi
e480053f86 Enhance Statistics
This will be used for public list of ASF STM bots in the future
2016-12-04 01:07:37 +01:00
JustArchi
137a53ef89 Improve readability of some specific segments 2016-11-24 07:46:37 +01:00
JustArchi
df218074ad Gigantic code cleanup
Time to enforce some common file layout, as general mess started to annoying me. Sorry in advance for people using custom forks and having merge conflicts, this will help everybody in long-run
2016-11-24 07:32:16 +01:00
JustArchi
e36704748a Modify ASF icon to include 32x32 variant (fixes Mono) 2016-11-11 02:00:27 +01:00
JustArchi
7cec546749 Misc 2016-11-09 09:26:07 +01:00
JustArchi
1ff4e8f60d Closes #354 2016-11-06 12:19:43 +01:00
JustArchi
8b3b822938 Rewrite entire ASF logging, as preparation for #354 2016-11-06 12:06:02 +01:00
JustArchi
43a56246c4 Optimize unused references 2016-11-05 08:06:56 +01:00
JustArchi
c6843b8347 Packages update 2016-11-05 08:03:42 +01:00
JustArchi
9594b69847 ASF icon design, closes #323
Thanks @stackia !
2016-11-01 13:54:01 +01:00
JustArchi
5c686397dd Packages update 2016-10-05 08:53:20 +02:00
JustArchi
2aec630b71 Final code review for today 2016-10-01 01:02:16 +02:00
JustArchi
4d6f2811bb Unify mono params 2016-09-12 20:52:30 +02:00
JustArchi
2c99c4b433 Misc 2016-09-02 18:41:40 +02:00