private void RemoveSession (Session session) { lock (sync) { sessions.Remove (session); } }
public async Task StartLisnening () { listener.Bind (new IPEndPoint (IPAddress.Any, this.localPort)); listener.Listen (backlogSize); while (true) { var acceptedSocket = await listener.AcceptAsync (); var acceptedSession = new Session (acceptedSocket, RemoveSession, this.destinationHost, this.destinationPort, this.localServerCertificate); sessions.Add (acceptedSession); } }
private void AddSession (Session session) { lock (sync) { sessions.Add (session); } }