Ejemplo n.º 1
0
        public async Task HandleAsync(TcpClient clientConn, CancellationToken cancellationToken)
        {
            var ipAddress = IpAddress(clientConn);

            _cons.AddOrUpdate(ipAddress, _ => clientConn, (_, _) => clientConn);

            try
            {
                await _executor.IoLoopAsync(clientConn, cancellationToken);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"client({ipAddress})");
            }

            _cons.TryRemove(ipAddress, out _);
        }