예제 #1
0
        internal void Reset(RUDPSocketStatus status)
        {
            RUDPStack.Trace("RESET PeerInformation");

            //---- Reset all
            _status = status;

            _fastRetransmitStartPacketId = -1;
            _fastRetransmitEndPacketId   = -1;

            _ougoingPacketId = -1;

            _sequence = 0;

            _lastSendTS    = 0;
            _lastACKSendTS = -1;

            _lastBandwidthTS       = 0;
            _bandwidthResponse01TS = 0;
            _bandwidth             = 0;

            //---- Clear outgoing
            _outgoingPacketsLock.EnterWriteLock();
            for (int index = 0; index < _outgoingPackets.Count; index++)
            {
                lock (_outgoingPackets[index])
                    _outgoingPackets[index].IsACKed = true;
            }
            _outgoingPacketsLock.ExitWriteLock();

            while (_outgoingPackets.Count > 0)
            {
                Thread.Sleep(1);
            }

            _incomingPackets.Clear();

            _sackWindow    = new SACKWindow();
            _pmtuDiscovery = new PMTUDiscovery(this);
            _controlWindow.Reset();

            // Reset "control thread id"
            RUDPStack.UnregisterRUDPSocket(this);
        }
예제 #2
0
		internal void Reset(RUDPSocketStatus status)
		{
			RUDPStack.Trace("RESET PeerInformation");

			//---- Reset all
			_status = status;

			_fastRetransmitStartPacketId = -1;
			_fastRetransmitEndPacketId = -1;

			_ougoingPacketId = -1;

			_sequence = 0;

			_lastSendTS = 0;
			_lastACKSendTS = -1;

			_lastBandwidthTS = 0;
			_bandwidthResponse01TS = 0;
			_bandwidth = 0;

			//---- Clear outgoing
			_outgoingPacketsLock.EnterWriteLock();
			for (int index = 0; index < _outgoingPackets.Count; index++)
				lock (_outgoingPackets[index])
					_outgoingPackets[index].IsACKed = true;
			_outgoingPacketsLock.ExitWriteLock();

			while (_outgoingPackets.Count > 0)
				Thread.Sleep(1);

			_incomingPackets.Clear();

			_sackWindow = new SACKWindow();
			_pmtuDiscovery = new PMTUDiscovery(this);
			_controlWindow.Reset();

			// Reset "control thread id"
			RUDPStack.UnregisterRUDPSocket(this);
		}