protected override IWampCancellableInvocation InnerInvoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails options, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords)
        {
            CancellationTokenSourceInvocation result = null;

            try
            {
                CancellationToken token = CancellationToken.None;

                if (SupportsCancellation)
                {
                    CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
                    result = new CancellationTokenSourceInvocation(cancellationTokenSource);
                    token  = cancellationTokenSource.Token;
                }

                Task <object> task =
                    InvokeAsync(caller,
                                formatter,
                                options,
                                arguments,
                                argumentsKeywords,
                                token);

                task.ContinueWith(x => TaskCallback(x, caller));
            }
            catch (WampException ex)
            {
                mLogger.ErrorFormat(ex, "An error occured while calling {0}", this.Procedure);
                IWampErrorCallback callback = new WampRpcErrorCallback(caller);
                callback.Error(ex);
            }

            return(result);
        }
示例#2
0
        protected override IWampCancellableInvocation InnerInvoke <TMessage>(IWampRawRpcOperationRouterCallback caller, IWampFormatter <TMessage> formatter, InvocationDetails details, TMessage[] arguments, IDictionary <string, TMessage> argumentsKeywords)
        {
            CancellationTokenSourceInvocation result = null;
            CancellationToken token = CancellationToken.None;

            if (SupportsCancellation)
            {
                CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
                result = new CancellationTokenSourceInvocation(cancellationTokenSource);
                token  = cancellationTokenSource.Token;
            }

            Task task =
                InnerInvokeAsync(caller,
                                 formatter,
                                 details,
                                 arguments,
                                 argumentsKeywords,
                                 token);

            return(result);
        }