DisallowAsyncActivation() static private method

static private DisallowAsyncActivation ( IMessage reqMsg ) : IMessage
reqMsg IMessage
return IMessage
        public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
        {
            IMessageCtrl       ctrl = null;
            MarshalByRefObject obj2;
            IDisposable        disposable;
            IMessage           msg = InternalSink.ValidateMessage(reqMsg);

            if (msg == null)
            {
                msg = InternalSink.DisallowAsyncActivation(reqMsg);
            }
            if (msg != null)
            {
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(msg);
                }
                return(ctrl);
            }
            IMessageSink objectChain = this.GetObjectChain(reqMsg, out obj2);

            if ((obj2 != null) && ((disposable = obj2 as IDisposable) != null))
            {
                DisposeSink sink2 = new DisposeSink(disposable, replySink);
                replySink = sink2;
            }
            return(objectChain.AsyncProcessMessage(reqMsg, replySink));
        }
Beispiel #2
0
        public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
        {
            IMessageCtrl result  = null;
            IMessage     message = InternalSink.ValidateMessage(reqMsg);

            if (message == null)
            {
                message = InternalSink.DisallowAsyncActivation(reqMsg);
            }
            if (message != null)
            {
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(message);
                }
            }
            else
            {
                MarshalByRefObject marshalByRefObject;
                IMessageSink       objectChain = this.GetObjectChain(reqMsg, out marshalByRefObject);
                IDisposable        iDis;
                if (marshalByRefObject != null && (iDis = (marshalByRefObject as IDisposable)) != null)
                {
                    DisposeSink disposeSink = new DisposeSink(iDis, replySink);
                    replySink = disposeSink;
                }
                result = objectChain.AsyncProcessMessage(reqMsg, replySink);
            }
            return(result);
        }
        public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
        {
            IMessageCtrl messageCtrl = (IMessageCtrl)null;
            IMessage     msg1        = InternalSink.ValidateMessage(reqMsg) ?? InternalSink.DisallowAsyncActivation(reqMsg);

            if (msg1 != null)
            {
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(msg1);
                }
            }
            else
            {
                MarshalByRefObject marshalByRefObject;
                IMessageSink       objectChain = this.GetObjectChain(reqMsg, out marshalByRefObject);
                IDisposable        iDis;
                if (marshalByRefObject != null && (iDis = marshalByRefObject as IDisposable) != null)
                {
                    replySink = (IMessageSink) new DisposeSink(iDis, replySink);
                }
                IMessage     msg2       = reqMsg;
                IMessageSink replySink1 = replySink;
                messageCtrl = objectChain.AsyncProcessMessage(msg2, replySink1);
            }
            return(messageCtrl);
        }
        public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
        {
            IMessage     message = InternalSink.ValidateMessage(reqMsg);
            IMessageCtrl result  = null;

            if (message == null)
            {
                message = InternalSink.DisallowAsyncActivation(reqMsg);
            }
            if (message != null)
            {
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(message);
                }
            }
            else
            {
                if (RemotingServices.CORProfilerTrackRemotingAsync())
                {
                    Guid guid;
                    RemotingServices.CORProfilerRemotingClientSendingMessage(out guid, true);
                    if (RemotingServices.CORProfilerTrackRemotingCookie())
                    {
                        reqMsg.Properties["CORProfilerCookie"] = guid;
                    }
                    if (replySink != null)
                    {
                        IMessageSink messageSink = new ClientAsyncReplyTerminatorSink(replySink);
                        replySink = messageSink;
                    }
                }
                Context currentContext = Thread.CurrentContext;
                currentContext.NotifyDynamicSinks(reqMsg, true, true, true, true);
                if (replySink != null)
                {
                    replySink = new AsyncReplySink(replySink, currentContext);
                }
                object[] array = new object[3];
                InternalCrossContextDelegate internalCrossContextDelegate = new InternalCrossContextDelegate(ClientContextTerminatorSink.AsyncProcessMessageCallback);
                IMessageSink channelSink = this.GetChannelSink(reqMsg);
                array[0] = reqMsg;
                array[1] = replySink;
                array[2] = channelSink;
                if (channelSink != CrossContextChannel.MessageSink)
                {
                    result = (IMessageCtrl)Thread.CurrentThread.InternalCrossContextCallback(Context.DefaultContext, internalCrossContextDelegate, array);
                }
                else
                {
                    result = (IMessageCtrl)internalCrossContextDelegate(array);
                }
            }
            return(result);
        }
        public virtual IMessageCtrl AsyncProcessMessage(IMessage reqMsg, IMessageSink replySink)
        {
            IMessage     msg  = InternalSink.ValidateMessage(reqMsg);
            IMessageCtrl ctrl = null;

            if (msg == null)
            {
                msg = InternalSink.DisallowAsyncActivation(reqMsg);
            }
            if (msg != null)
            {
                if (replySink != null)
                {
                    replySink.SyncProcessMessage(msg);
                }
                return(ctrl);
            }
            if (RemotingServices.CORProfilerTrackRemotingAsync())
            {
                Guid guid;
                RemotingServices.CORProfilerRemotingClientSendingMessage(out guid, true);
                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    reqMsg.Properties["CORProfilerCookie"] = guid;
                }
                if (replySink != null)
                {
                    IMessageSink sink = new ClientAsyncReplyTerminatorSink(replySink);
                    replySink = sink;
                }
            }
            Context currentContext = Thread.CurrentContext;

            currentContext.NotifyDynamicSinks(reqMsg, true, true, true, true);
            if (replySink != null)
            {
                replySink = new System.Runtime.Remoting.Messaging.AsyncReplySink(replySink, currentContext);
            }
            object[] args = new object[3];
            InternalCrossContextDelegate ftnToCall = new InternalCrossContextDelegate(ClientContextTerminatorSink.AsyncProcessMessageCallback);
            IMessageSink channelSink = this.GetChannelSink(reqMsg);

            args[0] = reqMsg;
            args[1] = replySink;
            args[2] = channelSink;
            if (channelSink != CrossContextChannel.MessageSink)
            {
                return((IMessageCtrl)Thread.CurrentThread.InternalCrossContextCallback(Context.DefaultContext, ftnToCall, args));
            }
            return((IMessageCtrl)ftnToCall(args));
        }