Esempio n. 1
0
        public virtual IMessage SyncProcessMessage(IMessage reqMsg)
        {
            IMessage message = InternalSink.ValidateMessage(reqMsg);

            if (message != null)
            {
                return(message);
            }
            ServerIdentity serverIdentity         = InternalSink.GetServerIdentity(reqMsg);
            ArrayWithSize  serverSideDynamicSinks = serverIdentity.ServerSideDynamicSinks;

            if (serverSideDynamicSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(reqMsg, serverSideDynamicSinks, false, true, false);
            }
            IMessageSink messageSink = this._stackBuilderSink.ServerObject as IMessageSink;
            IMessage     message2;

            if (messageSink != null)
            {
                message2 = messageSink.SyncProcessMessage(reqMsg);
            }
            else
            {
                message2 = this._stackBuilderSink.SyncProcessMessage(reqMsg);
            }
            if (serverSideDynamicSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(message2, serverSideDynamicSinks, false, false, false);
            }
            return(message2);
        }
        [System.Security.SecurityCritical]  // auto-generated
        public virtual IMessage     SyncProcessMessage(IMessage reqMsg)
        {
            Message.DebugOut("+++++++++++++++++++++++++ SrvObjTerminator: SyncProcessMsg\n");
            IMessage errMsg = ValidateMessage(reqMsg);

            if (errMsg != null)
            {
                return(errMsg);
            }

            ServerIdentity srvID = GetServerIdentity(reqMsg);

            BCLDebug.Assert(null != srvID, "null != srvID");
            ArrayWithSize objectSinks = srvID.ServerSideDynamicSinks;

            if (objectSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(
                    reqMsg,
                    objectSinks,
                    false,                  // bCliSide
                    true,                   // bStart
                    false);                 // bAsync
            }

            Message.DebugOut("ServerObjectTerminator.Invoking method on object\n");

            // Pass call on to the server object specific chain
            BCLDebug.Assert(null != _stackBuilderSink, "null != _stackBuilderSink");

            IMessage replyMsg;

            IMessageSink serverAsSink = _stackBuilderSink.ServerObject as IMessageSink;

            if (serverAsSink != null)
            {
                replyMsg = serverAsSink.SyncProcessMessage(reqMsg);
            }
            else
            {
                replyMsg = _stackBuilderSink.SyncProcessMessage(reqMsg);
            }

            if (objectSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(
                    replyMsg,
                    objectSinks,
                    false,                  // bCliSide
                    false,                  // bStart
                    false);                 // bAsync
            }
            return(replyMsg);
        }
Esempio n. 3
0
        internal static IMessage CallProcessMessage(IMessageSink ms, IMessage reqMsg, ArrayWithSize proxySinks, Thread currentThread, Context currentContext, bool bSkippingContextChain)
        {
            if (proxySinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(reqMsg, proxySinks, true, true, false);
            }
            bool flag = false;

            if (bSkippingContextChain)
            {
                flag = currentContext.NotifyDynamicSinks(reqMsg, true, true, false, true);
                ChannelServices.NotifyProfiler(reqMsg, RemotingProfilerEvent.ClientSend);
            }
            if (ms == null)
            {
                throw new RemotingException(Environment.GetResourceString("Remoting_Proxy_NoChannelSink"));
            }
            IMessage msg = ms.SyncProcessMessage(reqMsg);

            if (bSkippingContextChain)
            {
                ChannelServices.NotifyProfiler(msg, RemotingProfilerEvent.ClientReceive);
                if (flag)
                {
                    currentContext.NotifyDynamicSinks(msg, true, false, false, true);
                }
            }
            IMethodReturnMessage methodReturnMessage = msg as IMethodReturnMessage;

            if (msg == null || methodReturnMessage == null)
            {
                throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadType"));
            }
            if (proxySinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(msg, proxySinks, true, false, false);
            }
            return(msg);
        }
Esempio n. 4
0
        public virtual IMessage SyncProcessMessage(IMessage reqMsg)
        {
            IMessage message = InternalSink.ValidateMessage(reqMsg);

            if (message != null)
            {
                return(message);
            }
            ArrayWithSize sideDynamicSinks = InternalSink.GetServerIdentity(reqMsg).ServerSideDynamicSinks;

            if (sideDynamicSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(reqMsg, sideDynamicSinks, false, true, false);
            }
            IMessageSink messageSink = this._stackBuilderSink.ServerObject as IMessageSink;
            IMessage     msg         = messageSink == null?this._stackBuilderSink.SyncProcessMessage(reqMsg) : messageSink.SyncProcessMessage(reqMsg);

            if (sideDynamicSinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(msg, sideDynamicSinks, false, false, false);
            }
            return(msg);
        }
Esempio n. 5
0
        // This is used when a TP is called with SyncProcessMessage
        internal static IMessage CallProcessMessage(IMessageSink ms,
                                                    IMessage reqMsg,
                                                    ArrayWithSize proxySinks,
                                                    Thread currentThread,
                                                    Context currentContext,
                                                    bool bSkippingContextChain)
        {
            // Notify Dynamic Sinks: CALL starting
            if (proxySinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(
                    reqMsg,
                    proxySinks,
                    true,                           // bCliSide
                    true,                           // bStart
                    false);                         // bAsync
            }

            RemotingServices.LogRemotingStage(RemotingServices.CLIENT_MSG_SINK_CHAIN);

            bool bHasDynamicSinks = false;

            if (bSkippingContextChain)
            {
                // this would have been done in the client context terminator sink
                bHasDynamicSinks =
                    currentContext.NotifyDynamicSinks(reqMsg,
                                                      true,  // bCliSide
                                                      true,  // bStart
                                                      false, // bAsync
                                                      true); // bNotifyGlobals

                ChannelServices.NotifyProfiler(reqMsg, RemotingProfilerEvent.ClientSend);
            }

            if (ms == null)
            {
                throw new RemotingException(
                          Environment.GetResourceString(
                              "Remoting_Proxy_NoChannelSink"));
            }

            IMessage retMsg = ms.SyncProcessMessage(reqMsg);

            if (bSkippingContextChain)
            {
                // this would have been done in the client context terminator sink
                ChannelServices.NotifyProfiler(retMsg, RemotingProfilerEvent.ClientReceive);

                if (bHasDynamicSinks)
                {
                    currentContext.NotifyDynamicSinks(
                        retMsg,
                        true,   // bCliSide
                        false,  // bStart
                        false,  // bAsync
                        true);  // bNotifyGlobals
                }
            }

            IMethodReturnMessage mrm = retMsg as IMethodReturnMessage;

            if (retMsg == null || mrm == null)
            {
                throw new RemotingException(
                          Environment.GetResourceString("Remoting_Message_BadType"));
            }

            // notify DynamicSinks: CALL returned
            if (proxySinks != null)
            {
                DynamicPropertyHolder.NotifyDynamicSinks(
                    retMsg,
                    proxySinks,
                    true,                           // bCliSide
                    false,                          // bStart
                    false);                         // bAsync
            }


            RemotingServices.LogRemotingStage(RemotingServices.CLIENT_RET_PROPAGATION);

            return(retMsg);
        }