void INodeListenerObserver.OnAcceptTcpClient(TcpClient tcpClient) { try { lock (_acceptEventSyncLock) { LogUtility.Info(string.Format("Accept a new tcp client, LEP = {0}, REP={1}.", tcpClient.Client.LocalEndPoint, tcpClient.Client.RemoteEndPoint)); SaiConnectionServer saiConnection = null; // 查找客户端的ID //uint clientID; //var clientIdFound = this.GetClientID(tcpClient.Client.RemoteEndPoint as IPEndPoint, out clientID); //if (clientIdFound) //{ // // 查找对应的SaiConnection。 // var saiID = this.BuildSaiConnectionID(_rsspConfig.LocalID, clientID); // saiConnection = this.GetSaiConnection(saiID) as SaiConnectionServer; // if (saiConnection == null) // { // saiConnection = this.CreateSaiConnectionServer(clientID); // this.AddSaiConnection(saiID, saiConnection); // saiConnection.Open(); // } //} // SaiConnection是否有效 var saiConnectionValid = saiConnection != null; // 创建一个Ale通道。 var newTunnel = new AleServerTunnel(tcpClient, this, !saiConnectionValid); if (saiConnectionValid) { saiConnection.AddAleServerTunnel(newTunnel); } else { // 加入临时链表。 _serverTunnels.Add(newTunnel); // 当临时连接个数超过规定值时,记录日志。 var count = _serverTunnels.Count; if (count > 20) { LogUtility.Warn(string.Format("临时连接的TCP个数已达到{0}个。", count)); } } // 打开。 newTunnel.Open(); } } catch (System.Exception ex) { LogUtility.Error(string.Format("{0}", ex)); } }
public void AddAleServerTunnel(AleServerTunnel tunnel) { _aleConnection.AddAleServerTunnel(tunnel); }
public void HandleAleConnectionRequestFrame(AleServerTunnel connection, AleFrame requestFrame) { ((IAleTunnelObserver)_aleConnection).OnAleFrameArrival(connection, requestFrame); }
public void HandleAleConnectionRequestFrame(AleServerTunnel connection, AleFrame requestFrame) { _maslConnection.HandleAleConnectionRequestFrame(connection, requestFrame); }