コード例 #1
0
ファイル: TCPSession.cs プロジェクト: Paul1nh0/Singularity
        public new void ReInitialize(IProtocol !protocol)
        {
            base.ReInitialize(protocol);
            sessionTCB          = new TCB();
            sessionTCB.SND.WND  = TcpFormat.TCP_MSS;
            sessionTCB.RCV.WND  = TcpFormat.TCP_MSS;
            maxAcceptedSessions = 0;
            passiveSession      = null;
            isValidForRead      = true;
            isValidForWrite     = true;

            DrainQueue(outQueue);
            DrainQueue(inQueue);
            retransmitQ.Clear();
            acceptedSessions.Clear();
            setupCompleteEvent.Reset();
            closedEvent.Reset();

            // create and initialize the init state
            this.oldStateEnum = TcpStateEnum.Undefined;
            if (!IsClosed)
            {
                ChangeState(TCPFSM.CLOSED);
            }

            DestroyConnectTimer();
            DestroyShutdownTimer();
            DestroyPersistTimer();

            retransInterval = InitialRetransInterval;
        }
コード例 #2
0
ファイル: TCPSession.cs プロジェクト: Paul1nh0/Singularity
        public TcpSession(IProtocol !p)
            : base(p, TxQSize, RcvQSize)
        {
            sessionTCB           = new TCB();
            sessionTCB.SND.WND   = TcpFormat.TCP_MSS;
            sessionTCB.RCV.WND   = TcpFormat.TCP_MSS;
            retransmitQ          = new ArrayList(RetransmitQSize);
            acceptedSessions     = new ArrayList();
            maxAcceptedSessions  = 0;                   // Changed by Listen()
            acceptSessionMonitor = new object();

            setupCompleteEvent = new System.Threading.ManualResetEvent(false);
            closedEvent        = new System.Threading.ManualResetEvent(false);
            passiveSession     = null;

            // at first the session is valid (user can interact with it)
            isValidForRead  = true;
            isValidForWrite = true;

            // Assign the undifferentiated state (the parent of the
            //  specialized states) and then change the state to CLOSED.
            this.oldStateEnum = TcpStateEnum.Undefined;
            this.currentState = TcpState.InstanceOfUndefined();
            ChangeState(TCPFSM.CLOSED);
        }
コード例 #3
0
        public void Heartbeat(Thread t)
        {
            TCB tcb = GetTCB(t);

            if (tcb == null)
            {
                throw new System.ArgumentException("This thread was not registered!");
            }

            tcb.LastHeartbeat = DateTime.Now;
            tcb.HitTimes      = 0;
            tcb.Status       &= ~ThreadStatus.Hang;
        }
コード例 #4
0
 public void Read(AssetReader reader)
 {
     Index = reader.ReadInt32();
     TCB.Read(reader);
     Value = reader.ReadSingle();
 }
コード例 #5
0
 public void Read(AssetStream stream)
 {
     Index = stream.ReadInt32();
     TCB.Read(stream);
     Value = stream.ReadSingle();
 }