CheckIncomingMessage() static private method

static private CheckIncomingMessage ( IMessage msg ) : ReturnMessage
msg IMessage
return System.Runtime.Remoting.Messaging.ReturnMessage
        /// <summary>Synchronously dispatches the incoming message to the server-side chain(s) based on the URI embedded in the message.</summary>
        /// <returns>A reply message is returned by the call to the server-side chain.</returns>
        /// <param name="msg">The message to dispatch. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="msg" /> parameter is null. </exception>
        /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
        /// </PermissionSet>
        public static IMessage SyncDispatchMessage(IMessage msg)
        {
            IMessage message = ChannelServices.CheckIncomingMessage(msg);

            if (message != null)
            {
                return(ChannelServices.CheckReturnMessage(msg, message));
            }
            message = ChannelServices._crossContextSink.SyncProcessMessage(msg);
            return(ChannelServices.CheckReturnMessage(msg, message));
        }
        /// <summary>Asynchronously dispatches the given message to the server-side chain(s) based on the URI embedded in the message.</summary>
        /// <returns>A <see cref="T:System.Runtime.Remoting.Messaging.IMessageCtrl" /> object used to control the asynchronously dispatched message.</returns>
        /// <param name="msg">The message to dispatch. </param>
        /// <param name="replySink">The sink that will process the return message if it is not null. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="msg" /> parameter is null. </exception>
        /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
        /// </PermissionSet>
        public static IMessageCtrl AsyncDispatchMessage(IMessage msg, IMessageSink replySink)
        {
            IMessage message = ChannelServices.CheckIncomingMessage(msg);

            if (message != null)
            {
                replySink.SyncProcessMessage(ChannelServices.CheckReturnMessage(msg, message));
                return(null);
            }
            if (RemotingConfiguration.CustomErrorsEnabled(ChannelServices.IsLocalCall(msg)))
            {
                replySink = new ExceptionFilterSink(msg, replySink);
            }
            return(ChannelServices._crossContextSink.AsyncProcessMessage(msg, replySink));
        }