Ejemplo n.º 1
0
        public void AttachConnection(Connection connection, ConnectionArgs args)
        {
            var adapter = new PlayerIOConnectionAdapter(connection);

            try
            {
                this.SetConnection(adapter, args);
                this._adapter = adapter;
            }
            catch
            {
                adapter.Dispose();
                throw;
            }
        }
Ejemplo n.º 2
0
        public Task <IConnection> ConnectAsync()
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(nameof(RPCConnection));
            }

            if (this.Connection?.Connected ?? false)
            {
                return(TaskHelper.FromResult(this.Connection));
            }

            return(this.GetConnectionAsync()
                   .Then(t =>
            {
                this._connection = new PlayerIOConnectionAdapter(t.Result);
                return this.Connection;
            })
                   .ToSafeTask());
        }