Пример #1
0
    public void Update()
    {
        //List<NetIncomingMessage> mss = serverCore.GetMessages();
        //foreach (NetIncomingMessage m in ServerCore.messages)
        //Parallel.ForEach(ServerCore.messages, (m) =>
        List <NetIncomingMessage> mss = serverCore.GetMessages();

        lock (mss)
        {
            for (int i = 0; i < mss.Count; i++)
            {
                NetIncomingMessage m = mss[i];
                switch (m.MessageType)
                {
                case NetIncomingMessageType.ConnectionApproval:
                    if (TryApproveConnection(m))
                    {
                        m.SenderConnection.Approve();
                    }
                    else
                    {
                        m.SenderConnection.Deny();
                    }
                    mss.Remove(m);
                    //ServerCore.instance.UpdatePackets(false, m, ServerCore.messages);
                    break;
                }
            }
        }
    }