/// <summary>
 /// Returns whether or not a message received on a peer channel should be propagated, and if so, the destination of the message.
 /// </summary>
 /// <param name="message">The message to evaluate for propagation.</param>
 /// <param name="origination">A <see cref="T:System.ServiceModel.PeerMessageOrigination"/> enumeration value that specifies the origin (local or remote) of the message under evaluation.</param>
 /// <returns>
 /// A <see cref="T:System.ServiceModel.PeerMessagePropagation"/> enumeration value that indicates the destination of the message (local, remote, both, or no propagation at all).
 /// </returns>
 public override PeerMessagePropagation ShouldMessagePropagate(Message message, PeerMessageOrigination origination)
 {
     PeerMessagePropagation destination = PeerMessagePropagation.LocalAndRemote;
     if (origination == PeerMessageOrigination.Local)
         destination = PeerMessagePropagation.Remote;
     return destination;
 }
        PeerMessagePropagation IPeerNodeMessageHandling.DetermineMessagePropagation(Message message, PeerMessageOrigination origination)
        {
            PeerMessagePropagation propagateFlags = PeerMessagePropagation.LocalAndRemote;
            PeerMessagePropagationFilter filter = MessagePropagationFilter;
            if (filter != null)
            {
                try
                {
                    SynchronizationContext context = messagePropagationFilterContext;
                    if (context != null)
                    {
                        context.Send(delegate(object state) { propagateFlags = filter.ShouldMessagePropagate(message, origination); }, null);
                    }
                    else
                    {
                        propagateFlags = filter.ShouldMessagePropagate(message, origination);
                    }
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e)) throw;
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(SR.GetString(SR.MessagePropagationException), e);
                }
            }

            // Don't flood if the Node is closed
            if (!isOpen)
            {
                propagateFlags = PeerMessagePropagation.None;
            }

            return propagateFlags;
        }
        public override PeerMessagePropagation ShouldMessagePropagate(Message message, PeerMessageOrigination origination)
        {
            var destination = PeerMessagePropagation.LocalAndRemote;

            if (origination == PeerMessageOrigination.Local)
            {
                Trace.WriteLine("Remote-Only Message Propagation Filter Invoked.");
                destination = PeerMessagePropagation.Remote;
            }
            return(destination);
        }
 public abstract PeerMessagePropagation ShouldMessagePropagate(Message message, PeerMessageOrigination origination);
示例#5
0
 public abstract PeerMessagePropagation ShouldMessagePropagate(System.ServiceModel.Channels.Message message, PeerMessageOrigination origination);
 public abstract PeerMessagePropagation ShouldMessagePropagate(System.ServiceModel.Channels.Message message, PeerMessageOrigination origination);
 PeerMessagePropagation IPeerNodeMessageHandling.DetermineMessagePropagation(Message message, PeerMessageOrigination origination)
 {
     SendOrPostCallback d = null;
     PeerMessagePropagation propagateFlags = PeerMessagePropagation.LocalAndRemote;
     PeerMessagePropagationFilter filter = this.MessagePropagationFilter;
     if (filter != null)
     {
         try
         {
             SynchronizationContext messagePropagationFilterContext = this.messagePropagationFilterContext;
             if (messagePropagationFilterContext != null)
             {
                 if (d == null)
                 {
                     d = delegate (object state) {
                         propagateFlags = filter.ShouldMessagePropagate(message, origination);
                     };
                 }
                 messagePropagationFilterContext.Send(d, null);
             }
             else
             {
                 propagateFlags = filter.ShouldMessagePropagate(message, origination);
             }
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(System.ServiceModel.SR.GetString("MessagePropagationException"), exception);
         }
     }
     if (!this.isOpen)
     {
         propagateFlags = PeerMessagePropagation.None;
     }
     return propagateFlags;
 }
 public abstract PeerMessagePropagation ShouldMessagePropagate(Message message, PeerMessageOrigination origination);
示例#9
0
        /// <summary>
        /// Returns whether or not a message received on a peer channel should be propagated, and if so, the destination of the message.
        /// </summary>
        /// <param name="message">The message to evaluate for propagation.</param>
        /// <param name="origination">A <see cref="T:System.ServiceModel.PeerMessageOrigination"/> enumeration value that specifies the origin (local or remote) of the message under evaluation.</param>
        /// <returns>
        /// A <see cref="T:System.ServiceModel.PeerMessagePropagation"/> enumeration value that indicates the destination of the message (local, remote, both, or no propagation at all).
        /// </returns>
        public override PeerMessagePropagation ShouldMessagePropagate(Message message, PeerMessageOrigination origination)
        {
            PeerMessagePropagation destination = PeerMessagePropagation.LocalAndRemote;

            if (origination == PeerMessageOrigination.Local)
            {
                destination = PeerMessagePropagation.Remote;
            }
            return(destination);
        }
        public override PeerMessagePropagation ShouldMessagePropagate(System.ServiceModel.Channels.Message message, PeerMessageOrigination origination)
        {
            var destination = PeerMessagePropagation.LocalAndRemote;

            if (origination == PeerMessageOrigination.Local)
            {
                destination = PeerMessagePropagation.Remote;
            }

            return(destination);
        }
示例#11
0
 public override PeerMessagePropagation ShouldMessagePropagate(System.ServiceModel.Channels.Message message, PeerMessageOrigination origination)
 {
     return(PeerMessagePropagation.LocalAndRemote);
 }