Exemple #1
0
        private void OnMercuryEvent(object sender, MercuryEventBase e)
        {
            if (e.eventId == (int)EMercuryEvent.E_ME_OBJ_DELIVER)
            {
                MEObjDeliver evt = (MEObjDeliver)e;
                if (evt.opcode == (int)EObjDeliverOPCode.E_OP_HANDLE_FRAMEPACK)
                {
                    object[] args = (object[])evt.obj;
                    if (!HandleFrameCommandPackage((uint)args[0], args[1]))
                    {
                        uint frameID = (uint)args[0];
                        if (frameID >= _begFrqNo)
                        {
                            FrapWrap wrap = ObjectCachePool.instance.Fetch <FrapWrap>();
                            wrap.frameID = frameID;
                            wrap.data    = args[1];

                            //Èç¹û¸ÃÖ¡ÒÑ´æÔÚ£¬Ôò¶ªÆú
                            if (!Utility.LinkedListInsert(_laterFrames, wrap, FrapWrap.FrapWrapInsertComparsionFunc))
                            {
                                ProcessFrameDropInternal(frameID, wrap.data, false);
                                wrap.Release();
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        public void UpdateFrame()
        {
            if (Reconnection.instance.IsReconnection ||
                FrameSyncService.instance.ServiceMode == FrameSyncService.EServiceMode.E_SM_LOCALLY ||
                FrameSyncService.instance.ServiceMode == FrameSyncService.EServiceMode.E_SM_OB ||
                FrameSyncService.instance.ServiceMode == FrameSyncService.EServiceMode.E_SM_PLAYBACK)
            {
                return;
            }

            // Process later frames
            //ÍøÂçÌ«Èõ£¬ÑÓ³ÙÌ«¸ß£¬ÔòÆô¶¯ÐÞ¸´¡£
            while (_laterFrames.Count > 0)
            {
                FrapWrap wrap = _laterFrames.First.Value;
                if (HandleFrameCommandPackage(wrap.frameID, wrap.data))
                {
                    _laterFrames.RemoveFirst();
                    wrap.Release();

                    if (!_laterFrameTracing)
                    {
                        _laterFrameTracing = true;
                    }
                }
                else
                {
                    break;
                }
            }

            if (_maxFrqNo > _begFrqNo)
            {
                if (_receiveWindow[(int)_FrameNo2WindowIdx(_begFrqNo)] == null)
                {
                    if (_repairBegNo != _begFrqNo)
                    {
                        _repairBegNo = _begFrqNo;
                        RequestRepairLackFrames();
                        _repairTimes   = 0;
                        _repairCounter = 0;
                    }
                    else if (++_repairCounter > (2 ^ _repairTimes) * _timeoutFrameStep)
                    {
                        RequestRepairLackFrames();
                        _repairCounter = 0;
                        _repairTimes++;
                    }
                }
            }
        }