Beispiel #1
0
        // Token: 0x06000313 RID: 787 RVA: 0x0001366C File Offset: 0x0001186C
        private ICancelableAsyncResult BeginWrapper(string methodName, CancelableAsyncCallback asyncCallback, object asyncState, ClientBinding clientBinding, string legacyDn, Func <RfriContext, RfriDispatchTask> beginDelegate)
        {
            ICancelableAsyncResult asyncResult = null;

            RfriAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.ReferralTracer.IsTraceEnabled(TraceType.DebugTrace), delegate
            {
                if (ExTraceGlobals.ReferralTracer.IsTraceEnabled(TraceType.DebugTrace))
                {
                    using (ClientSecurityContext clientSecurityContext = clientBinding.GetClientSecurityContext())
                    {
                        ExTraceGlobals.ReferralTracer.TraceDebug(0, 0L, "{0} started. LegacyDn={1}. ClientAddress={2}. ServerAddress={3}. ProtocolSequence={4}. EndPoint={5}. IsEncrypted={6}. ClientSecurityContext={7}.", new object[]
                        {
                            methodName,
                            legacyDn,
                            clientBinding.ClientAddress,
                            clientBinding.ServerAddress,
                            clientBinding.ProtocolSequence,
                            clientBinding.ClientEndpoint,
                            clientBinding.IsEncrypted,
                            clientSecurityContext
                        });
                    }
                }
                FailureAsyncResult <RfriStatus> failureAsyncResult = null;
                this.CheckShuttingDown();
                try
                {
                    using (DisposeGuard disposeGuard = default(DisposeGuard))
                    {
                        RfriContext rfriContext = RfriAsyncDispatch.CreateRfriContext(clientBinding);
                        disposeGuard.Add <RfriContext>(rfriContext);
                        RfriDispatchTask rfriDispatchTask = beginDelegate(rfriContext);
                        disposeGuard.Add <RfriDispatchTask>(rfriDispatchTask);
                        asyncResult = rfriDispatchTask.AsyncResult;
                        this.SubmitTask(rfriDispatchTask);
                        disposeGuard.Success();
                    }
                }
                catch (FailRpcException ex)
                {
                    failureAsyncResult = new FailureAsyncResult <RfriStatus>((RfriStatus)ex.ErrorCode, IntPtr.Zero, ex, asyncCallback, asyncState);
                    asyncResult        = failureAsyncResult;
                }
                catch (RfriException ex2)
                {
                    failureAsyncResult = new FailureAsyncResult <RfriStatus>(ex2.Status, IntPtr.Zero, ex2, asyncCallback, asyncState);
                    asyncResult        = failureAsyncResult;
                }
                if (failureAsyncResult != null && !ThreadPool.QueueUserWorkItem(RfriAsyncDispatch.FailureWaitCallback, failureAsyncResult))
                {
                    failureAsyncResult.InvokeCallback();
                }
                ExTraceGlobals.ReferralTracer.TraceDebug <string>(0, 0L, "{0} succeeded.", methodName);
            }, delegate(Exception exception)
            {
                ExTraceGlobals.ReferralTracer.TraceDebug <string, Exception>(0, 0L, "{0} failed. Exception={1}.", methodName, exception);
            });
            return(asyncResult);
        }
        // Token: 0x060001A5 RID: 421 RVA: 0x00008FA8 File Offset: 0x000071A8
        private ICancelableAsyncResult BeginWrapper(string methodName, CancelableAsyncCallback asyncCallback, object asyncState, bool rundownContextOnFailure, Func <NspiContext, NspiDispatchTask> beginDelegate, Func <NspiContext> contextFactory)
        {
            int contextHandle = 0;
            ICancelableAsyncResult asyncResult = null;

            NspiAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.NspiTracer.IsTraceEnabled(TraceType.DebugTrace), delegate
            {
                bool flag = false;
                FailureAsyncResult <NspiStatus> failureAsyncResult = null;
                try
                {
                    this.CheckShuttingDown();
                    try
                    {
                        using (DisposeGuard disposeGuard = default(DisposeGuard))
                        {
                            NspiContext nspiContext           = contextFactory();
                            contextHandle                     = ((nspiContext != null) ? nspiContext.ContextHandle : 0);
                            NspiDispatchTask nspiDispatchTask = beginDelegate(nspiContext);
                            disposeGuard.Add <NspiDispatchTask>(nspiDispatchTask);
                            asyncResult = nspiDispatchTask.AsyncResult;
                            this.SubmitTask(nspiDispatchTask);
                            disposeGuard.Success();
                        }
                        flag = true;
                    }
                    catch (FailRpcException ex)
                    {
                        failureAsyncResult = new FailureAsyncResult <NspiStatus>((NspiStatus)ex.ErrorCode, new IntPtr(contextHandle), ex, asyncCallback, asyncState);
                        asyncResult        = failureAsyncResult;
                    }
                    catch (NspiException ex2)
                    {
                        failureAsyncResult = new FailureAsyncResult <NspiStatus>(ex2.Status, new IntPtr(contextHandle), ex2, asyncCallback, asyncState);
                        asyncResult        = failureAsyncResult;
                    }
                    if (failureAsyncResult != null && !ThreadPool.QueueUserWorkItem(NspiAsyncDispatch.FailureWaitCallback, failureAsyncResult))
                    {
                        failureAsyncResult.InvokeCallback();
                    }
                    ExTraceGlobals.NspiTracer.TraceDebug <string, int>(0, 0L, "{0} succeeded. ContextHandle={1}", methodName, contextHandle);
                }
                finally
                {
                    if (!flag && rundownContextOnFailure && contextHandle != 0)
                    {
                        this.ContextHandleRundown(new IntPtr(contextHandle));
                    }
                }
            }, delegate(Exception exception)
            {
                ExTraceGlobals.NspiTracer.TraceDebug <string, int, Exception>(0, 0L, "{0} failed. ContextHandle={1}, Exception={2}.", methodName, contextHandle, exception);
            });
            return(asyncResult);
        }
Beispiel #3
0
        // Token: 0x0600030E RID: 782 RVA: 0x00013290 File Offset: 0x00011490
        private static void FailureCallback(object state)
        {
            FailureAsyncResult <RfriStatus> failureAsyncResult = (FailureAsyncResult <RfriStatus>)state;

            failureAsyncResult.InvokeCallback();
        }