public bool Remove(Session session, out SenderReceiverPair pair) { return _Clients.TryRemove(session, out pair); }
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); } }
public bool Add(Session session, SenderReceiverPair pair) { return _Clients.TryAdd(session, pair); }