public override void HandleConnectionRequestFrame(AleTunnel theConnection, Frames.AleFrame theFrame) { var crData = theFrame.UserData as AleConnectionRequest; // 停止超时检测计时器。 theConnection.StopHandshakeTimer(); // 检查CR协议帧。 this.CheckCrFrame(crData, theConnection); // 检查AU1的正确性。 this.Context.AuMsgBuilder.CheckAu1Packet(crData.UserData); // 发送CC帧。 this.SendConnectionConfirmFrame(theConnection); if (!this.Context.ContainsTunnel(theConnection)) { // 事件通知:接收到一个新的TCP连接。 var args = new TcpConnectedEventArgs(theConnection.ID, this.Context.RsspEP.LocalID, theConnection.LocalEndPoint, this.Context.RsspEP.RemoteID, theConnection.RemoteEndPoint); this.Context.TunnelEventNotifier.NotifyTcpConnected(args); // 增加有效的连接个数。 theConnection.IsHandShaken = true; this.Context.IncreaseValidConnection(); // 保存TCP连接 this.Context.AddConnection(theConnection); } }
public override void HandleConnectionConfirmFrame(AleTunnel theConnection, Frames.AleFrame theFrame) { // 停止超时检测计时器。 theConnection.StopHandshakeTimer(); // 检查CC帧。 var ccData = theFrame.UserData as AleConnectionConfirm; this.CheckCcFrame(ccData); // 如果CC帧中的应答方编号校验通过,则增加一个有效的连接。 theConnection.IsHandShaken = true; this.Context.IncreaseValidConnection(); }
public override void HandleConnectionRequestFrame(AleTunnel theConnection, AleFrame theFrame) { var crData = theFrame.UserData as AleConnectionRequest; // 停止握手计时器。 theConnection.StopHandshakeTimer(); // 复位序号。 this.Context.SeqNoManager.Initlialize(); // 检查CR协议帧。 this.CheckCrFrame(crData, theConnection); // 更新服务类型。 this.Context.RsspEP.ServiceType = crData.ServiceType; // 将CR帧中的AU1提交到MASL(主要更新RandomB)。 this.Context.Observer.OnAleUserDataArrival(crData.UserData); // 发送CC帧。 this.SendConnectionConfirmFrame(theConnection); // 更新序号管理器的发送序号与确认序号。 this.Context.SeqNoManager.GetAndUpdateSendSeq(); this.Context.SeqNoManager.UpdateAckSeq(theFrame.SequenceNo); if (!this.Context.ContainsTunnel(theConnection)) { // 接收到一个新的TCP连接。 var args = new TcpConnectedEventArgs(theConnection.ID, this.Context.RsspEP.LocalID, theConnection.LocalEndPoint, this.Context.RsspEP.RemoteID, theConnection.RemoteEndPoint); this.Context.TunnelEventNotifier.NotifyTcpConnected(args); // 增加有效的连接个数。 theConnection.IsHandShaken = true; this.Context.IncreaseValidConnection(); // 保存TCP连接 this.Context.AddConnection(theConnection); } }
public override void HandleConnectionConfirmFrame(AleTunnel theConnection, AleFrame theFrame) { // 复位序号。 this.Context.SeqNoManager.Initlialize(); // 停止超时检测计时器。 theConnection.StopHandshakeTimer(); // 检查CC帧。 var ccData = theFrame.UserData as AleConnectionConfirm; this.CheckCcFrame(ccData); // 如果CC帧中的应答方编号校验通过,则增加一个有效的连接。 theConnection.IsHandShaken = true; this.Context.IncreaseValidConnection(); // 更新序号管理器的发送序号与确认序号。 this.Context.SeqNoManager.GetAndUpdateSendSeq(); this.Context.SeqNoManager.UpdateAckSeq(theFrame.SequenceNo); // 将CC帧中的AU2提交到MASL。 this.Context.Observer.OnAleUserDataArrival(ccData.UserData); }