コード例 #1
0
 private async Task <IpcEndpointInfo> AcceptAsync(ReversedDiagnosticsServer server)
 {
     using (var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(15)))
     {
         return(await server.AcceptAsync(cancellationSource.Token));
     }
 }
コード例 #2
0
            public EndpointInfoAccepter(ReversedDiagnosticsServer server, ITestOutputHelper outputHelper)
            {
                _server       = server;
                _outputHelper = outputHelper;

                _listenTask = ListenAsync(_cancellation.Token);
            }
コード例 #3
0
        /// <summary>
        /// Checks that the accepter does not provide a new endpoint info.
        /// </summary>
        private async Task VerifyNoNewEndpointInfos(ReversedDiagnosticsServer server, bool useAsync)
        {
            _outputHelper.WriteLine("Verifying there are no more connections.");

            var shim = new ReversedDiagnosticsServerApiShim(server, useAsync);

            await shim.Accept(DefaultNegativeVerificationTimeout, expectTimeout : true);

            _outputHelper.WriteLine("Verified there are no more connections.");
        }
コード例 #4
0
        /// <summary>
        /// Checks that the accepter does not provide a new endpoint info.
        /// </summary>
        private async Task VerifyNoNewEndpointInfos(ReversedDiagnosticsServer server)
        {
            _outputHelper.WriteLine("Verifying there are no more connections.");

            using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));

            Task acceptTask = server.AcceptAsync(cancellationSource.Token);
            await Assert.ThrowsAsync <TaskCanceledException>(() => acceptTask);

            Assert.True(acceptTask.IsCanceled);

            _outputHelper.WriteLine("Verified there are no more connections.");
        }
コード例 #5
0
        protected TcpServerRouterFactory(string tcpServer, int runtimeTimeoutMs, ILogger logger)
            : base(logger)
        {
            _tcpServerAddress = IpcTcpSocketEndPoint.NormalizeTcpIpEndPoint(string.IsNullOrEmpty(tcpServer) ? "127.0.0.1:0" : tcpServer);

            _auto_shutdown = runtimeTimeoutMs != Timeout.Infinite;
            if (runtimeTimeoutMs != Timeout.Infinite)
            {
                RuntimeTimeoutMs = runtimeTimeoutMs;
            }

            _tcpServer             = new ReversedDiagnosticsServer(_tcpServerAddress, enableTcpIpProtocol: true);
            _tcpServerEndpointInfo = new IpcEndpointInfo();
        }
コード例 #6
0
 public ServerIpcEndpoint(ReversedDiagnosticsServer server, Guid runtimeId)
 {
     _runtimeId = runtimeId;
     _server    = server;
 }
コード例 #7
0
 public ReversedDiagnosticsServerApiShim(ReversedDiagnosticsServer server, bool useAsync)
 {
     _server   = server;
     _useAsync = useAsync;
 }
コード例 #8
0
        private async Task <IpcEndpointInfo> AcceptEndpointInfo(ReversedDiagnosticsServer server, bool useAsync)
        {
            var shim = new ReversedDiagnosticsServerApiShim(server, useAsync);

            return(await shim.Accept(DefaultPositiveVerificationTimeout));
        }