public void FlushTest()
        {
            ClientSocketManager clientSocket = null;                                    // TODO: 初始化为适当的值
            MessagePump         messagePump  = null;                                    // TODO: 初始化为适当的值
            NetState            target       = new NetState(clientSocket, messagePump); // TODO: 初始化为适当的值
            bool expected = false;                                                      // TODO: 初始化为适当的值
            bool actual;

            actual = target.Flush();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Beispiel #2
0
        public static void LoginServerSeed(NetState state, PacketReader pvSrc)
        {
            int seed = pvSrc.ReadInt32(); // Seed

            int clientMaj = pvSrc.ReadInt32();
            int clientMin = pvSrc.ReadInt32();
            int clientRev = pvSrc.ReadInt32();
            int clientPat = pvSrc.ReadInt32();

            if ((seed == 0) && (clientMaj == 0) && (clientMin == 0) && (clientPat == 0) && (clientRev == 0))
            {
                state.SentFirstPacket = true;
                // This is UOExt. Cheers!
                state.Send(m_UOExtSupport);
                state.Flush();
                return;
            }

            // Enroute to old EF handler
            pvSrc.Seek(0, System.IO.SeekOrigin.Begin);
            m_OldEFHandler.OnReceive(state, pvSrc);
        }
Beispiel #3
0
        /// <summary>
        /// 发送全部的数据
        /// </summary>
        internal void FlushAll()
        {
            // 处理数据
            NetState[] netStateArray = null;

            m_LockNetStateFlush.Enter();
            {
                if (m_NetStateFlush.Count > 0)
                {
                    netStateArray = m_NetStateFlush.ToArray();
                    m_NetStateFlush.Clear();
                }
            }
            m_LockNetStateFlush.Exit();

            if (netStateArray == null)
            {
                return;
            }

            for (int iIndex = 0; iIndex < netStateArray.Length; iIndex++)
            {
                NetState netState = netStateArray[iIndex];
                if (netState.Running == true)   // 如果NetState有效
                {
                    netState.Flush();

                    netState.OutFlushQueue(); // 处理完毕

                    // 如果还有没有全部Flush的数据则添加(再次Flush数据),防止多线程漏处理的问题
                    if (netState.SendQueue.IsEmpty == false)
                    {
                        this.FlushNetStates(netState);
                    }
                }
            }
        }