Beispiel #1
0
        private async Task AcceptClientsAsync(CancellationToken ct)
        {
            while (!ct.IsCancellationRequested)
            {
                CheckClients(ct);
                var tConnection = await _transportManager.AcceptClientAsync().ConfigureAwait(false);

                var connection = _factory.Create(Guid.NewGuid().ToString(), tConnection, this);
                _connections.TryAdd(connection.ClientId, connection);

                //once again, just fire and forget, and use the CancellationToken
                //to signal to the "forgotten" async invocation.
                connection.ProcessCommandsAsync(ct);
            }
        }