albetros Big BUG in EffectThread

03/03/2012 15:03 somecode#1
PHP Code:


                
while (true)
                {
                    if (
Kernel.Clients 0)
                    {
                        foreach (
Player role in Kernel.Clients.Values)
                        {
                               .....
}
}

sleep(100)

alway throw An InvalidOperationException: collection was modified; may not be able to perform enumeration operation

how can i fix it ?
03/03/2012 15:07 I don't have a username#2
Switch it your collection out with a threadsafe one.
03/03/2012 15:10 pro4never#3
Indeed. I thought I already traded out the dictionary but apparently not.

Go to the clients dictionary in kernel.cs and change it to ThreadSafeDictionary. There's already a wrapper in the source for it.

Alternatively... re-write everything to use ConcurrentDictionary and take advantage of the lovely .net framework!
03/03/2012 15:16 somecode#4
Quote:
Originally Posted by pro4never View Post
Indeed. I thought I already traded out the dictionary but apparently not.

Go to the clients dictionary in kernel.cs and change it to ThreadSafeDictionary. There's already a wrapper in the source for it.

Alternatively... re-write everything to use ConcurrentDictionary and take advantage of the lovely .net framework!
i must be code a ThreadSafeDictionary class by myself ?

or your source already code it ?
03/03/2012 15:56 Korvacs#5
Quote:
Originally Posted by pro4never View Post
Indeed. I thought I already traded out the dictionary but apparently not.

Go to the clients dictionary in kernel.cs and change it to ThreadSafeDictionary. There's already a wrapper in the source for it.

Alternatively... re-write everything to use ConcurrentDictionary and take advantage of the lovely .net framework!
...

Quote:
Originally Posted by somecode View Post
i must be code a ThreadSafeDictionary class by myself ?

or your source already code it ?
Really? :rolleyes:
03/04/2012 06:52 somecode#6
i fixed that.... thx much

and i have another question

the server login 50+player ...
why did some time player attack make the cpu useg too high using 99%
sorry my bad english

i fixed that.... thx much

and i have another question

the server login 50+player ...
why did some time player attack make the cpu useg too high using 99%
sorry my bad english