private void OnServerConnectionAvailable(object sender, SecureConnectionResults args) { try { if (args.AsyncException != null) { _Log.ErrorFormat("Client connection failed {0}", args.AsyncException); return; } SslInfo sslInfo = args.SecureInfo; Session session = SessionMapping.Get(); Client client = new Client(sslInfo.SslStream, session, sslInfo.NetworkStream.BufferInUsed,sslInfo.Socket); SenderReceiverPair relation = new SenderReceiverPair(client, new ReceiveAgent()); Application.Default.AgentController.Add(session, relation.Receiver, relation.Sender); } catch (Exception ex) { _Log.Error(ex); } }
private void OnServerConnectionAvailable(object sender, SecureConnectionResults args) { if (args.AsyncException != null) { _Log.ErrorFormat("Client connection failed {0}", args.AsyncException); return; } try { SslInfo sslInfo = args.SecureInfo; long sessionMappingID = SessionMapping.Get(); ClientRelation relation = new ClientRelation(new Client(), new ReceiveAgent()); relation.Sender.BufferIndex = sslInfo.NetworkStream.BufferIndex; relation.Sender.Start(sslInfo.SslStream, sessionMappingID); AgentController.Default.Add(sessionMappingID, relation.Receiver, relation.Sender); } catch (Exception ex) { _Log.Error(ex); } }