예제 #1
0
        /// <summary>
        /// 由kcpserver的recvThread线程管理
        /// </summary>
        public void DeleteTimeOutLink(KcpListener kcp, long now)
        {
            int c = queue.Count - 1;

            for (int i = c; i >= 0; i--)
            {
                var link = queue[i];
                if (now - link.RecvTime > KcpListener.TimeOut)
                {
                    if (link.Disconnect())
                    {
                        link.RecyclingTime = now;
                        kcp.PreRecycling(link);
                        queue.RemoveAt(i);
                    }
                }
            }
        }
예제 #2
0
 public void Run(KcpListener listener, int threadCount)
 {
     kcpListener  = listener;
     statesBuffer = new BlockBuffer <int>(8, 2048 * threadCount);
 }