Пример #1
0
    IEnumerator CheckNetworkStatistics()
    {
        while (true)
        {
            DeliverStatistics statistics = RUDPUnityManager.Instance.GetDeliverStatistics();
            statistics.LossRate = (float)statistics.FailedPayloadCount / (float)statistics.AllPayloadCount;
            string str = String.Format(
                "Sending Payloads : {0} , Success : {1} , Loss : {2} \n Loss Rate : {3}%",
                statistics.AllPayloadCount, statistics.SuccessPayloadCount, statistics.FailedPayloadCount, statistics.LossRate);

            this.label.text = str;

            yield return(new WaitForSecondsRealtime(0.33f));
        }
    }
Пример #2
0
    public void Reset(ushort startSeqNum)
    {
        this.nextOutgoingSeqNum = startSeqNum;

        statistics = new DeliverStatistics();

        lock (this.inflightPayloadsLock) {
            this.inflightPayloads.Clear();
        }

        lock (this.lossPayloadSeqNumsLock) {
            this.lossPayloadSeqNums.Clear();
        }

        lock (this.successPayloadSeqNumsLock) {
            this.successPayloadSeqNums.Clear();
        }

        //UnityEngine.Debug.Log("Call Deliver Tracker Reset" + startSeqNum.ToString());
    }