private static void Invoke(object NotUsed, ref MessageData msgData) { Message reqMcmMsg = new Message(); reqMcmMsg.InitFields(msgData); Delegate thisPtr = reqMcmMsg.GetThisPtr() as Delegate; if (thisPtr == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Default")); } RemotingProxy realProxy = (RemotingProxy)RemotingServices.GetRealProxy(thisPtr.Target); if (realProxy != null) { realProxy.InternalInvoke(reqMcmMsg, true, reqMcmMsg.GetCallType()); } else { int callType = reqMcmMsg.GetCallType(); switch (callType) { case 1: case 9: { reqMcmMsg.Properties[Message.CallContextKey] = CallContext.GetLogicalCallContext().Clone(); AsyncResult retVal = new AsyncResult(reqMcmMsg); AgileAsyncWorkerItem state = new AgileAsyncWorkerItem(reqMcmMsg, ((callType & 8) != 0) ? null : retVal, thisPtr.Target); ThreadPool.QueueUserWorkItem(new WaitCallback(AgileAsyncWorkerItem.ThreadPoolCallBack), state); if ((callType & 8) != 0) { retVal.SyncProcessMessage(null); } reqMcmMsg.PropagateOutParameters(null, retVal); break; } case 2: RealProxy.EndInvokeHelper(reqMcmMsg, false); return; case 10: break; default: return; } } }
// Token: 0x06005742 RID: 22338 RVA: 0x00133030 File Offset: 0x00131230 private static void Invoke(object NotUsed, ref MessageData msgData) { Message message = new Message(); message.InitFields(msgData); object thisPtr = message.GetThisPtr(); Delegate @delegate; if ((@delegate = (thisPtr as Delegate)) == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Default")); } RemotingProxy remotingProxy = (RemotingProxy)RemotingServices.GetRealProxy(@delegate.Target); if (remotingProxy != null) { remotingProxy.InternalInvoke(message, true, message.GetCallType()); return; } int callType = message.GetCallType(); if (callType <= 2) { if (callType != 1) { if (callType != 2) { return; } RealProxy.EndInvokeHelper(message, false); return; } } else if (callType != 9) { return; } message.Properties[Message.CallContextKey] = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext.Clone(); AsyncResult asyncResult = new AsyncResult(message); AgileAsyncWorkerItem state = new AgileAsyncWorkerItem(message, ((callType & 8) != 0) ? null : asyncResult, @delegate.Target); ThreadPool.QueueUserWorkItem(new WaitCallback(AgileAsyncWorkerItem.ThreadPoolCallBack), state); if ((callType & 8) != 0) { asyncResult.SyncProcessMessage(null); } message.PropagateOutParameters(null, asyncResult); }
// Invoke for case where call is in the same context as the server object // (This special static method is used for AsyncDelegate-s ... this is called // directly from the EE) private static void Invoke(Object NotUsed, ref MessageData msgData) { Message m = new Message(); m.InitFields(msgData); Object thisPtr = m.GetThisPtr(); Delegate d; if ((d = thisPtr as Delegate) != null) { RemotingProxy rp = (RemotingProxy) RemotingServices.GetRealProxy(d.Target); if (rp != null) { rp.InternalInvoke(m, true, m.GetCallType()); } else { int callType = m.GetCallType(); AsyncResult ar; switch (callType) { case Message.BeginAsync: case Message.BeginAsync | Message.OneWay: // pick up call context from the thread m.Properties[Message.CallContextKey] = CallContext.GetLogicalCallContext().Clone(); ar = new AsyncResult(m); AgileAsyncWorkerItem workItem = new AgileAsyncWorkerItem( m, ((callType & Message.OneWay) != 0) ? null : ar, d.Target); ThreadPool.QueueUserWorkItem( new WaitCallback( AgileAsyncWorkerItem.ThreadPoolCallBack), workItem); if ((callType & Message.OneWay) != 0) { ar.SyncProcessMessage(null); } m.PropagateOutParameters(null, ar); break; case (Message.EndAsync | Message.OneWay): return; case Message.EndAsync: // This will also merge back the call context // onto the thread that called EndAsync RealProxy.EndInvokeHelper(m, false); break; default: BCLDebug.Assert( false, "Should never be here. Sync delegate code for agile object ended up in remoting"); break; } } } else { // Static invoke called with incorrect this pointer ... throw new RemotingException( Environment.GetResourceString( "Remoting_Default")); } }
private static void Invoke(object NotUsed, ref MessageData msgData) { Message reqMcmMsg = new Message(); reqMcmMsg.InitFields(msgData); Delegate thisPtr = reqMcmMsg.GetThisPtr() as Delegate; if (thisPtr == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Default")); } RemotingProxy realProxy = (RemotingProxy) RemotingServices.GetRealProxy(thisPtr.Target); if (realProxy != null) { realProxy.InternalInvoke(reqMcmMsg, true, reqMcmMsg.GetCallType()); } else { int callType = reqMcmMsg.GetCallType(); switch (callType) { case 1: case 9: { reqMcmMsg.Properties[Message.CallContextKey] = CallContext.GetLogicalCallContext().Clone(); AsyncResult retVal = new AsyncResult(reqMcmMsg); AgileAsyncWorkerItem state = new AgileAsyncWorkerItem(reqMcmMsg, ((callType & 8) != 0) ? null : retVal, thisPtr.Target); ThreadPool.QueueUserWorkItem(new WaitCallback(AgileAsyncWorkerItem.ThreadPoolCallBack), state); if ((callType & 8) != 0) { retVal.SyncProcessMessage(null); } reqMcmMsg.PropagateOutParameters(null, retVal); break; } case 2: RealProxy.EndInvokeHelper(reqMcmMsg, false); return; case 10: break; default: return; } } }