Example #1
0
        bool IsInvalid(TMessage message)
        {
            UniqueId messageId = OperationContext.Current.IncomingMessageHeaders.MessageId;

            if (messageId == null)
            {
                if (TD.DiscoveryMessageWithNullMessageIdIsEnabled())
                {
                    TD.DiscoveryMessageWithNullMessageId(null, ProtocolStrings.TracingStrings.Bye);
                }

                return(true);
            }

            EventTraceActivity eventTraceActivity = null;

            if (Fx.Trace.IsEtwProviderEnabled)
            {
                eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(OperationContext.Current.IncomingMessage);
            }

            if (this.announcementServiceImpl.IsDuplicate(messageId))
            {
                if (TD.DuplicateDiscoveryMessageIsEnabled())
                {
                    TD.DuplicateDiscoveryMessage(eventTraceActivity, ProtocolStrings.TracingStrings.Bye, messageId.ToString());
                }

                return(true);
            }
            else if (this.ValidateContent(message))
            {
                return(false);
            }
            else
            {
                if (TD.DiscoveryMessageWithInvalidContentIsEnabled())
                {
                    TD.DiscoveryMessageWithInvalidContent(eventTraceActivity, ProtocolStrings.TracingStrings.Bye, messageId.ToString());
                }

                return(true);
            }
        }