Пример #1
0
        private static void HandleClientThread()
        {
            while (!cancellation.IsCancellationRequested)
            {
                Context context = null;

                while (NewClients.Count == 0)
                {
                    Thread.Sleep(10);
                    if (cancellation.IsCancellationRequested)
                    {
                        return;
                    }
                }

                lock (NewClients)
                {
                    if (NewClients.Count == 0)
                    {
                        continue;
                    }

                    context = NewClients.Dequeue();
                }

                lock (ContextMapping)
                {
                    WebSocketClient client = ContextMapping[context];
                    client.SetupContext(context);
                }
            }
        }
Пример #2
0
        private static void HandleClientThread()
        {
            while (true)
            {
                Context context = null;

                while (NewClients.Count == 0)
                {
                    Thread.Sleep(10);
                }

                lock (NewClients)
                {
                    if (NewClients.Count == 0)
                    {
                        continue;
                    }

                    context = NewClients.Dequeue();
                }

                lock (ContextMapping)
                {
                    WebSocketClient client = ContextMapping[context];
                    client.SetupContext(context);
                }
            }
        }