コード例 #1
0
        public async Task <Connection> Connect(ReWorkClientRole role)
        {
            var cts         = new CancellationTokenSource();
            var tConnection = await _transportManager.ConnectAsync(role, cts.Token);

            var connection = _factory.Create(Guid.Empty.ToString(), tConnection, this);

            //once again, just fire and forget, and use the CancellationToken
            //to signal to the "forgotten" async invocation.
            connection.Authorize();
            connection.ProcessCommandsAsync(cts.Token);
            await connection.Send(new InitiateHandshakeMessage());

            return(connection);
        }
コード例 #2
0
        public Task <ITransportConnection> ConnectAsync(ReWorkClientRole role, CancellationToken ctx)
        {
            var client = new TcpClient(role.Host, role.Port);

            return(Task.FromResult(new ReworkTcpTransport(client, _commandConverter, _protocol) as ITransportConnection));
        }
コード例 #3
0
 public Connection Start(ReWorkClientRole role)
 {
     return(Start().Connect(role).ConfigureAwait(false).GetAwaiter().GetResult());
 }