Esempio n. 1
0
        // This is called from InternalInvoke above when someone makes an
        // Async (or a one way) call on a TP
        internal void InternalInvokeAsync(IMessageSink ar, Message reqMsg,
                                          bool useDispatchMessage, int callType)
        {
            IMessageCtrl     cc       = null;
            Identity         idObj    = IdentityObject;
            ServerIdentity   serverID = idObj as ServerIdentity;
            MethodCall       cpyMsg   = new MethodCall(reqMsg);
            IInternalMessage iim      = ((IInternalMessage)cpyMsg);

            // Set the identity in the message object
            iim.IdentityObject = idObj;
            if (null != serverID)
            {
                Message.DebugOut("Setting SrvID on deser msg\n");
                iim.ServerIdentityObject = serverID;
            }

            if (useDispatchMessage)
            {
                Message.DebugOut(
                    "RemotingProxy.Invoke: Calling AsyncDispatchMessage\n");

                BCLDebug.Assert(ar != null, "ar != null");
                BCLDebug.Assert((callType & Message.BeginAsync) != 0,
                                "BeginAsync flag not set!");

                Message.DebugOut("Calling AsynDispatchMessage \n");
                cc = ChannelServices.AsyncDispatchMessage(
                    cpyMsg,
                    ((callType & Message.OneWay) != 0)
                                        ? null : ar);
            }
            else if (null != idObj.EnvoyChain)
            {
                Message.DebugOut("RemotingProxy.Invoke: Calling AsyncProcessMsg on the envoy chain\n");

                cc = idObj.EnvoyChain.AsyncProcessMessage(
                    cpyMsg,
                    ((callType & Message.OneWay) != 0)
                                        ? null : ar);
            }
            else
            {
                // Channel sink cannot be null since it is the last sink in
                // the client context
                // Assert if Invoke is called without a channel sink
                BCLDebug.Assert(false, "How did we get here?");

                throw new InvalidOperationException(
                          Environment.GetResourceString("Remoting_Proxy_InvalidState"));
            }

            if ((callType & Message.BeginAsync) != 0)
            {
                if ((callType & Message.OneWay) != 0)
                {
                    ar.SyncProcessMessage(null);
                }
            }
        }
Esempio n. 2
0
        internal void InternalInvokeAsync(IMessageSink ar, Message reqMsg, bool useDispatchMessage, int callType)
        {
            Identity         identityObject  = this.IdentityObject;
            ServerIdentity   serverIdentity  = identityObject as ServerIdentity;
            MethodCall       methodCall      = new MethodCall((IMessage)reqMsg);
            IInternalMessage internalMessage = (IInternalMessage)methodCall;

            internalMessage.IdentityObject = identityObject;
            if (serverIdentity != null)
            {
                internalMessage.ServerIdentityObject = serverIdentity;
            }
            if (useDispatchMessage)
            {
                ChannelServices.AsyncDispatchMessage((IMessage)methodCall, (callType & 8) != 0 ? (IMessageSink)null : ar);
            }
            else
            {
                if (identityObject.EnvoyChain == null)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("Remoting_Proxy_InvalidState"));
                }
                identityObject.EnvoyChain.AsyncProcessMessage((IMessage)methodCall, (callType & 8) != 0 ? (IMessageSink)null : ar);
            }
            if ((callType & 1) == 0 || (callType & 8) == 0)
            {
                return;
            }
            ar.SyncProcessMessage((IMessage)null);
        }
Esempio n. 3
0
        internal void InternalInvokeAsync(IMessageSink ar, Message reqMsg, bool useDispatchMessage, int callType)
        {
            Identity         identityObject = this.IdentityObject;
            ServerIdentity   identity2      = identityObject as ServerIdentity;
            MethodCall       msg            = new MethodCall(reqMsg);
            IInternalMessage message        = msg;

            message.IdentityObject = identityObject;
            if (identity2 != null)
            {
                message.ServerIdentityObject = identity2;
            }
            if (useDispatchMessage)
            {
                ChannelServices.AsyncDispatchMessage(msg, ((callType & 8) != 0) ? null : ar);
            }
            else
            {
                if (identityObject.EnvoyChain == null)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("Remoting_Proxy_InvalidState"));
                }
                identityObject.EnvoyChain.AsyncProcessMessage(msg, ((callType & 8) != 0) ? null : ar);
            }
            if (((callType & 1) != 0) && ((callType & 8) != 0))
            {
                ar.SyncProcessMessage(null);
            }
        }