internal static object SyncProcessMessageCallback(object[] args)
        {
            IMessage msg      = args[0] as IMessage;
            Context  context  = args[1] as Context;
            IMessage message2 = null;

            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid empty = Guid.Empty;
                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    object obj2 = msg.Properties["CORProfilerCookie"];
                    if (obj2 != null)
                    {
                        empty = (Guid)obj2;
                    }
                }
                RemotingServices.CORProfilerRemotingServerReceivingMessage(empty, false);
            }
            context.NotifyDynamicSinks(msg, false, true, false, true);
            message2 = context.GetServerContextChain().SyncProcessMessage(msg);
            context.NotifyDynamicSinks(message2, false, false, false, true);
            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid guid2;
                RemotingServices.CORProfilerRemotingServerSendingReply(out guid2, false);
                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    message2.Properties["CORProfilerCookie"] = guid2;
                }
            }
            return(message2);
        }
Ejemplo n.º 2
0
        public virtual IMessage SyncProcessMessage(IMessage replyMsg)
        {
            Guid id;

            RemotingServices.CORProfilerRemotingServerSendingReply(out id, true);
            if (RemotingServices.CORProfilerTrackRemotingCookie())
            {
                replyMsg.Properties[(object)"CORProfilerCookie"] = (object)id;
            }
            return(this._nextSink.SyncProcessMessage(replyMsg));
        }
Ejemplo n.º 3
0
        internal static object SyncProcessMessageCallback(object[] args)
        {
            IMessage msg1    = args[0] as IMessage;
            Context  context = args[1] as Context;

            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid id = Guid.Empty;
                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    object obj = msg1.Properties[(object)"CORProfilerCookie"];
                    if (obj != null)
                    {
                        id = (Guid)obj;
                    }
                }
                RemotingServices.CORProfilerRemotingServerReceivingMessage(id, false);
            }
            IMessage msg2 = msg1;
            int      num1 = 0;
            int      num2 = 1;
            int      num3 = 0;
            int      num4 = 1;

            context.NotifyDynamicSinks(msg2, num1 != 0, num2 != 0, num3 != 0, num4 != 0);
            IMessage message = context.GetServerContextChain().SyncProcessMessage(msg1);
            IMessage msg3    = message;
            int      num5    = 0;
            int      num6    = 0;
            int      num7    = 0;
            int      num8    = 1;

            context.NotifyDynamicSinks(msg3, num5 != 0, num6 != 0, num7 != 0, num8 != 0);
            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid id;
                RemotingServices.CORProfilerRemotingServerSendingReply(out id, false);
                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    message.Properties[(object)"CORProfilerCookie"] = (object)id;
                }
            }
            return((object)message);
        }
Ejemplo n.º 4
0
        public virtual IMessage SyncProcessMessage(IMessage replyMsg)
        {
            // If this class has been brought into the picture, then the following must be true.
            BCLDebug.Assert(RemotingServices.CORProfilerTrackRemoting(),
                            "CORProfilerTrackRemoting returned false, but we're in AsyncProcessMessage!");
            BCLDebug.Assert(RemotingServices.CORProfilerTrackRemotingAsync(),
                            "CORProfilerTrackRemoting returned false, but we're in AsyncProcessMessage!");

            Guid g;

            // Notify the profiler that we are receiving an async reply from the server-side
            RemotingServices.CORProfilerRemotingServerSendingReply(out g, true);

            // If GUID cookies are active, then we save it for the other end of the channel
            if (RemotingServices.CORProfilerTrackRemotingCookie())
            {
                replyMsg.Properties["CORProfilerCookie"] = g;
            }

            // Now that we've done the intercepting, pass the message on to the regular chain
            return(_nextSink.SyncProcessMessage(replyMsg));
        }
Ejemplo n.º 5
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static Object SyncProcessMessageCallback(Object[] args)
        {
            IMessage reqMsg   = args[0] as IMessage;
            Context  srvCtx   = args[1] as Context;
            IMessage replyMsg = null;

            // If profiling of remoting is active, must tell the profiler that we have received
            // a message.
            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid g = Guid.Empty;

                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    Object obj = reqMsg.Properties["CORProfilerCookie"];

                    if (obj != null)
                    {
                        g = (Guid)obj;
                    }
                }

                RemotingServices.CORProfilerRemotingServerReceivingMessage(g, false);
            }

            Message.DebugOut("::::::::::::::::::::::::: CrossContext Channel: passing to ServerContextChain");

            // Server side notifications for dynamic sinks are done
            // in the x-context channel ... this is to maintain
            // symmetry of the point of notification between
            // the client and server context
            srvCtx.NotifyDynamicSinks(
                reqMsg,
                false,          // bCliSide
                true,           // bStart
                false,          // bAsync
                true);          // bNotifyGlobals

            replyMsg = srvCtx.GetServerContextChain().SyncProcessMessage(reqMsg);
            srvCtx.NotifyDynamicSinks(
                replyMsg,
                false,          // bCliSide
                false,          // bStart
                false,          // bAsync
                true);          // bNotifyGlobals

            Message.DebugOut("::::::::::::::::::::::::: CrossContext Channel: back from ServerContextChain");

            // If profiling of remoting is active, must tell the profiler that we are sending a
            // reply message.
            if (RemotingServices.CORProfilerTrackRemoting())
            {
                Guid g;

                RemotingServices.CORProfilerRemotingServerSendingReply(out g, false);

                if (RemotingServices.CORProfilerTrackRemotingCookie())
                {
                    replyMsg.Properties["CORProfilerCookie"] = g;
                }
            }
            return(replyMsg);
        }
Ejemplo n.º 6
0
        public virtual IMessage     SyncProcessMessage(IMessage reqMsg)
        {
            IMessage replyMsg = null;

            try
            {
                Message.DebugOut("\n::::::::::::::::::::::::: CrossContext Channel: Sync call starting");
                IMessage errMsg = ValidateMessage(reqMsg);
                if (errMsg != null)
                {
                    return(errMsg);
                }

                ServerIdentity srvID = GetServerIdentity(reqMsg);
                Message.DebugOut("Got Server identity \n");
                BCLDebug.Assert(null != srvID, "null != srvID");


                BCLDebug.Assert(null != srvID.ServerContext, "null != srvID.ServerContext");

                bool fEnteredContext         = false;
                ContextTransitionFrame frame = new ContextTransitionFrame();
                try
                {
                    Context srvCtx = srvID.ServerContext;
                    Thread.CurrentThread.EnterContext(srvCtx, ref frame);
                    fEnteredContext = true;
                    // If profiling of remoting is active, must tell the profiler that we have received
                    // a message.
                    if (RemotingServices.CORProfilerTrackRemoting())
                    {
                        Guid g = Guid.Empty;

                        if (RemotingServices.CORProfilerTrackRemotingCookie())
                        {
                            Object obj = reqMsg.Properties["CORProfilerCookie"];

                            if (obj != null)
                            {
                                g = (Guid)obj;
                            }
                        }

                        RemotingServices.CORProfilerRemotingServerReceivingMessage(g, false);
                    }

                    Message.DebugOut("::::::::::::::::::::::::: CrossContext Channel: passing to ServerContextChain");

                    // Server side notifications for dynamic sinks are done
                    // in the x-context channel ... this is to maintain
                    // symmetry of the point of notification between
                    // the client and server context
                    srvCtx.NotifyDynamicSinks(
                        reqMsg,
                        false,          // bCliSide
                        true,           // bStart
                        false,          // bAsync
                        true);          // bNotifyGlobals

                    replyMsg = srvCtx.GetServerContextChain().SyncProcessMessage(reqMsg);
                    srvCtx.NotifyDynamicSinks(
                        replyMsg,
                        false,          // bCliSide
                        false,          // bStart
                        false,          // bAsync
                        true);          // bNotifyGlobals

                    Message.DebugOut("::::::::::::::::::::::::: CrossContext Channel: back from ServerContextChain");

                    // If profiling of remoting is active, must tell the profiler that we are sending a
                    // reply message.
                    if (RemotingServices.CORProfilerTrackRemoting())
                    {
                        Guid g;

                        RemotingServices.CORProfilerRemotingServerSendingReply(out g, false);

                        if (RemotingServices.CORProfilerTrackRemotingCookie())
                        {
                            replyMsg.Properties["CORProfilerCookie"] = g;
                        }
                    }
                }
                finally
                {
                    if (fEnteredContext)
                    {
                        Thread.CurrentThread.ReturnToContext(ref frame);
                    }
                }
            }
            catch (Exception e)
            {
                Message.DebugOut("Arrgh.. XCTXSink::throwing exception " + e + "\n");
                replyMsg = new ReturnMessage(e, (IMethodCallMessage)reqMsg);
                if (reqMsg != null)
                {
                    ((ReturnMessage)replyMsg).SetLogicalCallContext(
                        (LogicalCallContext)
                        reqMsg.Properties[Message.CallContextKey]);
                }
            }

            Message.DebugOut("::::::::::::::::::::::::::: CrossContext Channel: Sync call returning!!\n");
            return(replyMsg);
        }