Example #1
0
        private void SendThread()
        {
            while (IsConnected)
            {
                try
                {
                    if (mKCP != null)
                    {
                        uint time = Current;
                        if (time >= mNextUpdateTime)
                        {
                            mKCP.Update(time);
                            mNextUpdateTime = mKCP.Check(time);
                        }
                    }
                }
                catch (Exception e)
                {
                    Close();
                    throw e;
                }

                Thread.Sleep(1);
            }
        }
Example #2
0
 private void UpdateKcp()
 {
     if (mKCP != null)
     {
         uint time = current;
         if (time >= mNextUpdateTime)
         {
             mKCP.Update(time);
             mNextUpdateTime = mKCP.Check(time);
         }
     }
 }
Example #3
0
        public void Update(UInt32 current)
        {
            ProcessRecv(current);
            var err = GetError();

            if (err != null)
            {
                throw err;
            }
            if (needUpdate || current > nextUpdateTime)
            {
                kcp.Update(current);
                nextUpdateTime = kcp.Check(current);
                needUpdate     = false;
            }
            CheckTimeout(current);
        }
Example #4
0
        public void UpdateKcp()
        {
            if (mKCP == null)
            {
                return;
            }
            if (mService == null || mService.kcp == null || mService.kcp.IsActive == false)
            {
                return;
            }

            uint time = current;

            if (time >= mNextUpdateTime)
            {
                mKCP.Update(time);
                mNextUpdateTime = mKCP.Check(time);
            }
        }