Пример #1
0
        public static int Run(ClientOptions opts, CancellationTokenSource cancellationSource)
        {
            var clients = Client.StartClients(opts.EndPoint, opts, cancellationSource.Token);

            ResultMonitor.MonitorResults(clients, opts, cancellationSource);

            Task.WaitAll(clients.Select(c => c.CloseAsync()).ToArray());
            return(1);
        }
Пример #2
0
        public static int Run(InProcOptions opts, CancellationTokenSource cancellationSource)
        {
            var(ep, finished) = opts.Tcp
                ? ServerListener.StartTcpTls(new IPEndPoint(IPAddress.Loopback, 0), opts.CertificateFile, opts.PrivateKeyFile, cancellationSource.Token)
                : ServerListener.StartQuic(new IPEndPoint(IPAddress.Loopback, 0), opts.CertificateFile, opts.PrivateKeyFile, cancellationSource.Token);

            var clients = Client.StartClients(ep, opts, cancellationSource.Token);

            ResultMonitor.MonitorResults(clients, opts, cancellationSource);
            Task.WaitAll(clients.Select(c => c.CloseAsync()).Concat(new [] { finished }).ToArray());

            return(0);
        }