예제 #1
0
        internal static NspiContext GetContext(int contextHandle)
        {
            NspiContext result = null;

            if (!ClientContextCache.TryGetContext(contextHandle, out result))
            {
                ExTraceGlobals.NspiTracer.TraceError((long)contextHandle, "Unable to find contextHandle in context dictionary");
                throw new InvalidHandleException("Failed to find contextHandle in context dictionary.");
            }
            return(result);
        }
 // Token: 0x0600019D RID: 413 RVA: 0x00008B6C File Offset: 0x00006D6C
 public void ContextHandleRundown(IntPtr contextHandle)
 {
     if (contextHandle == IntPtr.Zero)
     {
         return;
     }
     if (!this.isShuttingDown)
     {
         NspiAsyncDispatch.ExecuteAndIgnore("ContextHandleRundown", delegate
         {
             NspiContext nspiContext = null;
             using (DisposeGuard disposeGuard = default(DisposeGuard))
             {
                 if (ClientContextCache.TryGetContext(contextHandle.ToInt32(), out nspiContext))
                 {
                     disposeGuard.Add <NspiContext>(nspiContext);
                     ClientContextCache.DeleteContext(contextHandle.ToInt32());
                     nspiContext.Unbind(true);
                 }
             }
         });
     }
 }
 // Token: 0x060001A4 RID: 420 RVA: 0x00008D90 File Offset: 0x00006F90
 private ICancelableAsyncResult BeginContextWrapper(string methodName, CancelableAsyncCallback asyncCallback, object asyncState, IntPtr contextHandle, Func <NspiContext, NspiDispatchTask> beginDelegate)
 {
     return(this.BeginWrapper(methodName, asyncCallback, asyncState, false, beginDelegate, () => ClientContextCache.GetContext(contextHandle.ToInt32())));
 }
 // Token: 0x06000175 RID: 373 RVA: 0x00007468 File Offset: 0x00005668
 public ICancelableAsyncResult BeginUnbind(ProtocolRequestInfo protocolRequestInfo, IntPtr contextHandle, NspiUnbindFlags flags, CancelableAsyncCallback asyncCallback, object asyncState)
 {
     return(this.BeginWrapper("BeginUnbind", asyncCallback, asyncState, true, (NspiContext context) => new NspiUnbindDispatchTask(asyncCallback, asyncState, protocolRequestInfo, context, flags), () => ClientContextCache.GetContext(contextHandle.ToInt32())));
 }
 // Token: 0x06000173 RID: 371 RVA: 0x00007308 File Offset: 0x00005508
 public ICancelableAsyncResult BeginBind(ProtocolRequestInfo protocolRequestInfo, ClientBinding clientBinding, NspiBindFlags flags, NspiState state, Guid?guid, CancelableAsyncCallback asyncCallback, object asyncState)
 {
     return(this.BeginWrapper("BeginBind", asyncCallback, asyncState, true, (NspiContext context) => new NspiBindDispatchTask(asyncCallback, asyncState, protocolRequestInfo, clientBinding, context, flags, state, guid), () => ClientContextCache.CreateContext(clientBinding)));
 }