private static void HandleClientThread()
        {
            while (!Handler.Shutdown.Token.IsCancellationRequested)
            {
                Context context;

                while (ContextQueue.Count == 0)
                {
                    Thread.Sleep(10);
                    if (Handler.Shutdown.IsCancellationRequested)
                    {
                        return;
                    }
                }

                if (!ContextQueue.TryDequeue(out context))
                {
                    continue;
                }

                lock (ContextMapping)
                {
                    WebSocketServer server = ContextMapping[context];
                    server.SetupContext(context);
                }

                lock (CurrentConnections){
                    CurrentConnections.Add(context);
                }
            }
        }
Ejemplo n.º 2
0
        private static void HandleClientThread()
        {
            while (true)
            {
                Context context;

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

                if (!ContextQueue.TryDequeue(out context))
                {
                    continue;
                }

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

                lock (CurrentConnections){
                    CurrentConnections.Add(context);
                }
            }
        }